Revoke refresh token upon logout. (#1696)

* Revoke refresh token upon logout.
* Always log out
This commit is contained in:
Kenneth Geisshirt 2018-03-09 15:51:45 +01:00 committed by GitHub
parent abb04e399b
commit 9d8a677ecf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 1 deletions

View File

@ -23,6 +23,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).

View File

@ -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:') {

View File

@ -103,7 +103,7 @@ public:
static void session_for_on_disk_path(ContextType, FunctionType, ObjectType, size_t, const ValueType[], ReturnValue &);
MethodMap<T> const methods = {
{"logout", wrap<logout>},
{"_logout", wrap<logout>},
{"_sessionForOnDiskPath", wrap<session_for_on_disk_path>}
};
};