mirror of
https://github.com/status-im/realm-js.git
synced 2025-02-05 03:03:50 +00:00
Logging in using an admin token should be synchronous (#2040)
* Logging in using an admin token should be synchronous
This commit is contained in:
parent
6e15b2ed8e
commit
be98a77fcf
@ -4,14 +4,13 @@ x.x.x Release notes (yyyy-MM-dd)
|
|||||||
* None
|
* None
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
* <How to hit and notice issue? what was the impact?> ([#????](https://github.com/realm/realm-js/issues/????), since v?.?.?)
|
* Fixed a bug where logging in using an admin token returned a promise. The correct behavior is to be synchronous. (related to [#2037](https://github.com/realm/realm-js/issues/2037), since v2.16.1)
|
||||||
* None
|
|
||||||
|
|
||||||
### Compatibility
|
### Compatibility
|
||||||
* File format: ver. 7 (upgrades automatically from previous formats)
|
* File format: ver. 7 (upgrades automatically from previous formats)
|
||||||
* Realm Object Server: 3.11.0 or later.
|
* Realm Object Server: 3.0.0 or later.
|
||||||
* APIs are backwards compatible with all previous release of realm in the 2.x.y series.
|
* APIs are backwards compatible with all previous release of realm in the 2.x.y series.
|
||||||
|
|
||||||
### Internal
|
### Internal
|
||||||
* None
|
* None
|
||||||
|
|
||||||
@ -25,7 +24,7 @@ x.x.x Release notes (yyyy-MM-dd)
|
|||||||
|
|
||||||
### Compatibility
|
### Compatibility
|
||||||
* File format: ver. 7 (upgrades automatically from previous formats)
|
* File format: ver. 7 (upgrades automatically from previous formats)
|
||||||
* Realm Object Server: 3.11.0 or later.
|
* Realm Object Server: 3.0.0 or later.
|
||||||
* APIs are backwards compatible with all previous release of realm in the 2.x.y series.
|
* APIs are backwards compatible with all previous release of realm in the 2.x.y series.
|
||||||
|
|
||||||
### Internal
|
### Internal
|
||||||
|
@ -382,7 +382,7 @@ const staticMethods = {
|
|||||||
checkTypes(arguments, ['string', 'object']);
|
checkTypes(arguments, ['string', 'object']);
|
||||||
if (credentials.identityProvider === 'adminToken') {
|
if (credentials.identityProvider === 'adminToken') {
|
||||||
let u = this._adminUser(server, credentials.token);
|
let u = this._adminUser(server, credentials.token);
|
||||||
return Promise.resolve(u);
|
return u;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _authenticate(this, server, credentials);
|
return _authenticate(this, server, credentials);
|
||||||
|
@ -29,7 +29,7 @@ function node_require(module) {
|
|||||||
return require_method(module);
|
return require_method(module);
|
||||||
}
|
}
|
||||||
|
|
||||||
let fs;
|
let fs;
|
||||||
if (isNodeProcess) {
|
if (isNodeProcess) {
|
||||||
fs = node_require('fs');
|
fs = node_require('fs');
|
||||||
}
|
}
|
||||||
@ -206,12 +206,8 @@ module.exports = {
|
|||||||
let token = obj['ADMIN_TOKEN'];
|
let token = obj['ADMIN_TOKEN'];
|
||||||
|
|
||||||
let credentials = Realm.Sync.Credentials.adminToken(token);
|
let credentials = Realm.Sync.Credentials.adminToken(token);
|
||||||
return Realm.Sync.User.login('http://localhost:9080', credentials)
|
let user = Realm.Sync.User.login('http://localhost:9080', credentials);
|
||||||
.then((user) => {
|
TestCase.assertTrue(user.isAdmin);
|
||||||
TestCase.assertTrue(user.isAdmin);
|
|
||||||
Promise.resolve();
|
|
||||||
})
|
|
||||||
.catch((e) => { Promise.reject(e) } );
|
|
||||||
},
|
},
|
||||||
|
|
||||||
testAll() {
|
testAll() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user