Skip to content

Commit 2d1c154

Browse files
Stanislavvengrov
authored andcommitted
fix parsing user after social login (#49)
* fix parsing user after social login - closes #12953 * disallow using social login methods in synchronous way * add stayLoggedIn param to wrapAsync
1 parent 446fade commit 2d1c154

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

libs/backendless.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1826,8 +1826,12 @@
18261826
},
18271827

18281828
_loginSocial: function(socialType, fieldsMapping, permissions, async, container, stayLoggedIn) {
1829+
if (!async) {
1830+
throw new Error('Social login can not be called as synchronous method')
1831+
}
1832+
18291833
var socialContainer = new this._socialContainer(socialType, container);
1830-
async = async && this._wrapAsync(async);
1834+
async = this._wrapAsync(async, stayLoggedIn);
18311835

18321836
Utils.addEvent('message', window, function(e) {
18331837
if (e.origin == Backendless.serverURL) {
@@ -1836,9 +1840,7 @@
18361840
if (result.fault) {
18371841
async.fault(result.fault);
18381842
} else {
1839-
Backendless.LocalCache.set("stayLoggedIn", !!stayLoggedIn);
1840-
currentUser = this.Backendless.UserService._parseResponse(result);
1841-
async.success(this.Backendless.UserService._getUserFromResponse(currentUser));
1843+
async.success(result);
18421844
}
18431845

18441846
Utils.removeEvent('message', window);

0 commit comments

Comments
 (0)