Facebook user information using only an OAuth Token

倖福魔咒の 提交于 2020-01-25 06:32:05

问题


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?


回答1:


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




回答2:


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



来源:https://stackoverflow.com/questions/6271249/facebook-user-information-using-only-an-oauth-token

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!