Is it possible to find out in which user an access_token belongs to?
I have an access_token. And I would like to find the user id that created this access_token.
Thanks
Is it possible to find out in which user an access_token belongs to?
I have an access_token. And I would like to find the user id that created this access_token.
Thanks
Yes, user id is contained in the access token. If you have an access token that looks something like:
1234567890|2.a3KGHbLrzTqw__.86400.129394400-102450226|-XY1zH_PN-nbTtyhDPc
102450226 is your used id. You would have to do split the string by "|", take the middle part then split by "-" and take the last part.
Maggie's answer is correct, although the fact that the uid is visible in the string of the access token may not always be true. That said, I'm not aware of anything on the roadmap to change the access token format.
Two other options:
Make a graph API call to https://graph.facebook.com/me?fields=id&access_token=[ACCESS TOKEN HERE]
- if the token is still valid you'll get back an answer like this:
{
"id": "[UID HERE]"
}
Use the access token linter at https://developers.facebook.com/tools/access_token/lint
You can use the debugger available for facebook developers at this location https://developers.facebook.com/tools/debug You can know more about all the access tokens - user, app and page.