开发者

Facebook user information using only an OAuth Token

开发者 https://www.devze.com 2023-03-11 21:15 出处:网络
开发者_如何学CDue to user error, a situation has arisen in which my database holds an Oauth token for a facebook user without that person\'s facebook id, proper name, or the email linked with the face
开发者_如何学C

Due to user error, a situation has arisen in which my database holds an Oauth token for a facebook user without that person's facebook id, proper name, or the email linked with the facebook account. Using only the Oauth token, is it possible to get the user's facebook id or other information?


If the token's still valid, try fetching https://graph.facebook.com/me?fields=id&access_token=____


The token holds all the information you need - as explained by Ben Biddington (and probably many other places) part of the token (between the pipes (|)) is the session-key, in this format:

2.{secret}.3600.{expires_at_seconds_after_epoch}-{user_id}

so if your token looks something like

1234567890|2.3onmAQCJpDQDrbT6.3600.1307484000.0-987654321|316cKUabM1Z-5X4P8k4sJdnW8ok

the session-key is

2.3onmAQCJpDQDrbT6.3600.1307484000.0-987654321

and then the user id will be 987654321

0

精彩评论

暂无评论...
验证码 换一张
取 消