Logging in using an admin token should be synchronous (#2040)

* Logging in using an admin token should be synchronous
This commit is contained in:
Kenneth Geisshirt 2018-09-24 12:43:44 +02:00 committed by GitHub
parent 6e15b2ed8e
commit be98a77fcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 13 deletions

View File

@ -4,12 +4,11 @@ x.x.x Release notes (yyyy-MM-dd)
* None
### Fixes
* <How to hit and notice issue? what was the impact?> ([#????](https://github.com/realm/realm-js/issues/????), since v?.?.?)
* None
* 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)
### Compatibility
* 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.
### Internal
@ -25,7 +24,7 @@ x.x.x Release notes (yyyy-MM-dd)
### Compatibility
* 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.
### Internal

View File

@ -382,7 +382,7 @@ const staticMethods = {
checkTypes(arguments, ['string', 'object']);
if (credentials.identityProvider === 'adminToken') {
let u = this._adminUser(server, credentials.token);
return Promise.resolve(u);
return u;
}
return _authenticate(this, server, credentials);

View File

@ -29,7 +29,7 @@ function node_require(module) {
return require_method(module);
}
let fs;
let fs;
if (isNodeProcess) {
fs = node_require('fs');
}
@ -206,12 +206,8 @@ module.exports = {
let token = obj['ADMIN_TOKEN'];
let credentials = Realm.Sync.Credentials.adminToken(token);
return Realm.Sync.User.login('http://localhost:9080', credentials)
.then((user) => {
TestCase.assertTrue(user.isAdmin);
Promise.resolve();
})
.catch((e) => { Promise.reject(e) } );
let user = Realm.Sync.User.login('http://localhost:9080', credentials);
TestCase.assertTrue(user.isAdmin);
},
testAll() {