ruby-on-railsruby-on-rails-3facebookfacebook-graph-apifacebooker

Find a user from an access_token


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


Solution

  • 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.