What field can I use using secure social on play! framework with facebook?
-
20-06-2021 - |
Pergunta
How can I make sure that the same user has logged in?
SecureSocial is returning the following fields:
id, isEmailVerified, avatarUrl, email, password, secret, token, authMethod
Some fields are empty, and everytime I log in the id changes. For example, once it is securesocial.provider.UserId@4bc348d3 and another time it is securesocial.provider.UserId@68a895ba. I thought of using the email address for finding out if the same user logged in, but the email address of the user can be changed in the facebook profile. The field token is empty. Is there any other field I can use to make certain that it is the same user who logs in ?
Solução
It is a different object each time (of course!), but inside the UserId
class, you'll find the id
the provider is using to identify the user -- So, to uniquely identify a user, use a combination of UserId.id
and UserId.provider
.