diff --git a/CHANGELOG.md b/CHANGELOG.md index df773158..8d83470c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -2.3.0 Release notes (2018-3-7) +2.3.0 Release notes (2018-3-9) ============================================================= ### Breaking changes * [Sync] Sync protocol changed to version 24. @@ -25,6 +25,7 @@ - Method `Realm.privilges()` to compute privileges on a Realm, a Realm object schema, or a Realm object. The method returns either a `Realm.Permissions.Realm` or `Realm.Permissions.Class` object. - For non-synced Realms, all privileges are always granted. - For more details, please read the reference documentation. +* [Sync] Revoke refresh tiken upon logout (#1354). * Added `Realm.defaultSyncConfiguration()` which will return the configuration for a default synced Realm (#1688). * [Sync] Decrepated `Realm.Sync.setFeatureToken` (#1689). diff --git a/dependencies.list b/dependencies.list index 1247f305..97edfddc 100644 --- a/dependencies.list +++ b/dependencies.list @@ -1,5 +1,5 @@ PACKAGE_NAME=realm-js -VERSION=2.3.0-beta.2 +VERSION=2.3.0-beta.3 REALM_CORE_VERSION=5.4.0 REALM_SYNC_VERSION=3.0.0-rc.1 REALM_OBJECT_SERVER_VERSION=3.0.0-alpha.8 diff --git a/lib/user-methods.js b/lib/user-methods.js index 9634ef37..efbdfae8 100644 --- a/lib/user-methods.js +++ b/lib/user-methods.js @@ -348,6 +348,27 @@ const staticMethods = { const instanceMethods = { + logout() { + this._logout(); + const url = url_parse(this.server); + url.set('pathname', '/auth/revoke'); + const headers = { + Authorization: this.token + }; + const body = { + token: this.token + }; + const options = { + method: 'POST', + headers, + body: body, + open_timeout: 5000 + }; + + performFetch(url.href, options) + .then(() => console.log('User is logged out')) + .catch((e) => print_error(e)); + }, openManagementRealm() { let url = url_parse(this.server); if (url.protocol === 'http:') { diff --git a/package.json b/package.json index fc8c2276..4ea4e0c4 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "realm", "description": "Realm is a mobile database: an alternative to SQLite and key-value stores", - "version": "2.3.0-beta.2", + "version": "2.3.0-beta.3", "license": "Apache-2.0", "homepage": "https://realm.io", "keywords": [ diff --git a/src/js_sync.hpp b/src/js_sync.hpp index b78f9cba..1a3ff6d0 100644 --- a/src/js_sync.hpp +++ b/src/js_sync.hpp @@ -103,7 +103,7 @@ public: static void session_for_on_disk_path(ContextType, FunctionType, ObjectType, size_t, const ValueType[], ReturnValue &); MethodMap const methods = { - {"logout", wrap}, + {"_logout", wrap}, {"_sessionForOnDiskPath", wrap} }; };