I'm using Auth0-Lock for authenticating a user. But it seems that the response data from Auth0 did not include Facebook user_id. I want to get user_id because I need it to show user's profile URL in my app, like this: www.facebook.com/{user_id}.
{
"sub": "facebook|1613270415401150",
"given_name": "Steve",
"family_name": "Giáp",
"nickname": "hgbk.it",
"name": "Steve Giáp",
"picture": "https://graph.facebook.com/v2.5/1613270415401150/picture?width=720",
"gender": "male",
"locale": "en-GB",
"updated_at": "2018-10-09T04:25:12.921Z"
}
The Id from sub or picture are not related to user_id.
The
user_idthat Auth0 uses is the id that is provided by the identity provider and in the case of Facebook they are now app-scoped. Therefore, theuser_idis not the user id of the user, but rather an identifier for the user for this specific application. As per Facebook docsThe id of this person's user account. This ID is unique to each app and cannot be used across different apps.This is theidthat Auth0 uses as theuser_id, following the pipe, e.g.facebook|<id from Facebook>. I believe you used to be able to use thatidto see a person's public profile, but Facebook has since deprecated providing theusername.