问题描述
我想从我的个人网站的facebook的api中拉出最近的图像。我似乎找不到只有验证我的用户没有登录对话框的方式。有人知道这是否可行?我可以在图形API资源管理器中生成用户访问令牌,但在1小时内到期。您不能!
但是您可以这个令牌,适用于 60天 - 称为长寿命令牌。因此,如果用户在60天内至少访问一次您的应用程序,您可以无限期地访问用户的数据。
简单的呼叫来获得长命的用户访问令牌 -
GET / oauth / access_token?
grant_type = fb_exchange_token&
client_id = {app-id}&
client_secret = {app-secret}&
fb_exchange_token = {short-lived-token}
刷新此令牌 - 用户必须再次通过登录过程(调用 login
API)获取短命令,然后对60天到期的新鲜长寿命令进行相同的交换。 p>
您还可以随时使用 -
GET / debug_token调试您的令牌?
input_token = {input-token}&
access_token = {access-token} //有效的用户访问令牌或应用访问令牌
I want to pull my most recent images from facebook's api for my personal website. I cannot seem to find a way to only authenticate my user without the login dialog. Does anyone know if this is possible? I can generate my user access token inside the graph API Explorer, but it expires in 1 hour.
You cannot!
But you can extend this token that will be valid for 60 days - called the long-lived token. So, if a user visits your application at least once in 60 days you can have the access to user's data indefinitely.
Simple call to get the long-lived user access token-
GET /oauth/access_token?
grant_type=fb_exchange_token&
client_id={app-id}&
client_secret={app-secret}&
fb_exchange_token={short-lived-token}
Refreshing this token- The user have to go through the login process again (calling login
API) to get the short-lived token and then perform the same exchange for a fresh long lived token with 60 days expiry.
You can also debug your token anytime with-
GET /debug_token?
input_token={input-token}&
access_token={access-token} // a valid user access token or app access token
这篇关于如何无限期地获得我自己的Facebook用户访问令牌?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!