-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
…mous
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -199,6 +199,57 @@ describe('rest create', () => { | |
}); | ||
}); | ||
|
||
it('test facebook login that is already have account and is logged with a anonymous user', (done) => { | ||
var dataAnonymous = { | ||
authData: { | ||
anonymous: { | ||
id: '00000000-0000-0000-0000-000000000001' | ||
} | ||
} | ||
}; | ||
var data = { | ||
authData: { | ||
facebook: { | ||
id: '8675309', | ||
access_token: 'jenny' | ||
} | ||
} | ||
}; | ||
var newUserSignedUpByFacebookObjectId; | ||
var anonymousResponse; | ||
rest.create(config, auth.nobody(config), '_User', data) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
Scoup
Author
|
||
.then((r) => { | ||
console.log('facebook user', r.response); | ||
// facebook user sign up | ||
newUserSignedUpByFacebookObjectId = r.response.objectId; | ||
return rest.create(config, auth.nobody(config), '_User', dataAnonymous); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
Scoup
Author
|
||
}).then((r) => { | ||
console.log('anonymous user:', r.response); | ||
// logged anonymous | ||
var anonymousResponse = r.response; | ||
data.authData.objectId = r.response.objectId; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
flovilmart
Contributor
|
||
data.authData.anonymous = null; | ||
return rest.update(config, auth.nobody(config), '_User', data.authData.objectId, data); | ||
This comment has been minimized.
Sorry, something went wrong.
flovilmart
Contributor
|
||
}).then((r) => { | ||
console.log('login', r); | ||
expect(typeof r.response.objectId).toEqual('string'); | ||
expect(typeof r.response.createdAt).toEqual('string'); | ||
expect(typeof r.response.username).toEqual('string'); | ||
expect(typeof r.response.updatedAt).toEqual('string'); | ||
expect(r.response.objectId).toEqual(newUserSignedUpByFacebookObjectId); | ||
return rest.find(config, auth.master(config), | ||
'_Session', {sessionToken: r.response.sessionToken}); | ||
}).then((response) => { | ||
expect(response.results.length).toEqual(1); | ||
var output = response.results[0]; | ||
expect(output.user.objectId).toEqual(newUserSignedUpByFacebookObjectId); | ||
done(); | ||
}) | ||
.catch((err) => { | ||
console.log('err', err); | ||
}); | ||
}); | ||
|
||
it('stores pointers with a _p_ prefix', (done) => { | ||
var obj = { | ||
foo: 'bar', | ||
|
8 comments
on commit 0f3116e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with old sdk facebook and old ParseFBUtils...
ParseFacebookUtils.logIn(activity, new LogInCallback() { @Override public void done(ParseUser user, ParseException err) { onFacebookParseRegistrationEnded(err); } });
// the new sdk Parse new ParseFBUtils
ParseFacebookUtils.logInInBackground(AccessToken.getCurrentAccessToken(), new LogInCallback() { @Override public void done(ParseUser parseUser, ParseException e) { onFacebookParseRegistrationEnded(e); } }); return;
@flovilmart the weird thing is when we point to the cloud parse works fine. When we point to our server does not work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And you can confirm that the anonUser objectId is sent along the login request?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we using ParseUser.enableAutomaticUser();
before the login request.
enableAutomaticUser() Enables automatic creation of anonymous users.
You can try login with sample app using facebook in Parse-server, login will work , after login. Try logout and login again. Here this flow fail.
I believe the server is not differentiating if I'm trying to make a login or sign in with facebook.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you get your server in VERBOSE so I can see what requests are sent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @flovilmart, here is the log:
I printed all the request so you can see what was sent.
When he started he didn't have account, he login anonymous, after facebook, then logout and tries to login again and then fails.
Thank you for your help.
Edit: I'm using the lastest version of parse-server in npm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I can see the logs, I know what's going on and this will fixed by #952.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is great!!! I will start working with your branch.
Thank you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much @flovilmart .
there you create a Facebook logged in user, not an anon user