Revoke refresh token upon logout. (#1696)
* Revoke refresh token upon logout. * Always log out
This commit is contained in:
parent
abb04e399b
commit
9d8a677ecf
|
@ -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).
|
||||
|
||||
|
|
|
@ -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:') {
|
||||
|
|
|
@ -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>}
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue