From 7b91ee98edf64fbb4ad7c4f7b038608633b9dae8 Mon Sep 17 00:00:00 2001 From: Drew Date: Wed, 20 Apr 2016 15:42:18 -0700 Subject: [PATCH] Fixes #1568 (#1574) --- spec/ParseUser.spec.js | 19 ++++++++++++++++++- src/Controllers/DatabaseController.js | 3 ++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/spec/ParseUser.spec.js b/spec/ParseUser.spec.js index 161e0cbd18..e93c6a015a 100644 --- a/spec/ParseUser.spec.js +++ b/spec/ParseUser.spec.js @@ -1028,6 +1028,23 @@ describe('Parse.User testing', () => { }); }); + it('returns authData when authed and logged in with provider (regression test for #1498)', done => { + Parse.Object.enableSingleInstance(); + let provider = getMockFacebookProvider(); + Parse.User._registerAuthenticationProvider(provider); + Parse.User._logInWith('facebook', { + success: user => { + let userQuery = new Parse.Query(Parse.User); + userQuery.get(user.id) + .then(user => { + expect(user.get('authData')).not.toBeUndefined(); + Parse.Object.disableSingleInstance(); + done(); + }); + } + }); + }); + it('log in with provider with files', done => { let provider = getMockFacebookProvider(); Parse.User._registerAuthenticationProvider(provider); @@ -2272,7 +2289,7 @@ describe('Parse.User testing', () => { } }); }); - + it('should not create extraneous session tokens', (done) => { let config = new Config(Parse.applicationId); config.database.loadSchema().then((s) => { diff --git a/src/Controllers/DatabaseController.js b/src/Controllers/DatabaseController.js index 8f6f4cf4c9..46c84174d6 100644 --- a/src/Controllers/DatabaseController.js +++ b/src/Controllers/DatabaseController.js @@ -112,13 +112,14 @@ DatabaseController.prototype.untransformObject = function( return object; } - delete object.authData; delete object.sessionToken; if (isMaster || (aclGroup.indexOf(object.objectId) > -1)) { return object; } + delete object.authData; + return object; };