Reputation: 603
I have a facebook connect app all set up using oauth and after the final transaction I receive an access_token that looks something like -
559514387926|f53be3fc76b8e243aaf2944b-502835064|moXh_HOIga8b32txRdwkan-5NW9.
The part in bold seems to be facebook user id of the current user. I checked this with all the access_tokens of the users I have thus far and it matches in every case.
Is there any documentation that states that this is a reliable way to obtain the facebook user id ?
I want to use the facebook user id directly to make leaner calls for existing users pulling only picture and pulling a lot more data for a first time user.
Upvotes: 3
Views: 764
Reputation: 6376
Do not parse the token, this is bad practise and since Facebook is in the middle of adding new features to the Graph API it is very susceptible to breaking changes. Make an API call to
https://graph.facebook.com/me?access_token=...
And then parse out the id parameter and use that from then on!
Upvotes: 4