Facebook不到期访问令牌 [英] Facebook non-expiring access token
问题描述
我按照这篇文章中提到的步骤:
现在我有一个访问令牌,期限为60天,但
当我打开 https://graph.facebook.com/me/accounts ,我收到此错误:
{
error:{
message:必须使用活动的访问令牌来查询有关当前用户的信息。,
type: OAuthException,
code:2500
}
}
因为我的访问令牌有效期是2个月,应该是有效的。
1:创建在您的网站上的一个应用程序网址
2:在浏览器中运行此链接
3:访问以下产生一个新的SHORT-LIVED(1小时)访问令牌:
https://www.facebook.com?client_id = [APPID]& client_secret = [APPSECRET]& redirect_uri [http:// APPURL]& scope = manage_pages,read_stream& response_type = token
4:采取短暂的访问令牌并发送到此处:
https ://graph.facebook.com/oauth/access_token?client_id = [APP_ID]& client_secret = [APP_SECRET]& grant_type = fb_exchange_token& fb_exchange_token = [EXISTING_ACCESS_TOKEN]
5:然后,在FB的Graph API Explorer或您自己的访问中,访问:
https://graph.facebook.com/me/accounts?access_token= [TOKEN]
然后粘贴令牌和ID代码,那么你将得到结果。
您可以使用 FaceBook访问令牌调试器:
I want to show the last facebook post on my website. I have a script for it but it needs access token to work.
I followed the steps mentioned in this post:
Now I've got an access token with an expiry period of 60 days but when I open https://graph.facebook.com/me/accounts, I get this error:
{
"error": {
"message": "An active access token must be used to query information about the current user.",
"type": "OAuthException",
"code": 2500
}
}
as my access token validity is 2 months, It is supposed to work.
1: Create an application in facebook with your website url
2: Run this link in your browser
3: Visit the following to generate a new SHORT-LIVED (1 hour) access token:
https://www.facebook.com?client_id=[APPID]&client_secret=[APPSECRET]&redirect_uri[http://APPURL]&scope=manage_pages,read_stream&response_type=token
4: Take that short-lived access token and send it here:
https://graph.facebook.com/oauth/access_token?client_id=[APP_ID]&client_secret=[APP_SECRET]&grant_type=fb_exchange_token&fb_exchange_token=[EXISTING_ACCESS_TOKEN]
5: Then, either in FB’s Graph API Explorer or on your own, visit here:
https://graph.facebook.com/me/accounts?access_token=[TOKEN]
Then paste the token and id in the code, then you will get the result.
You can debug and verify the expiration date of your token using the FaceBook Access Token Debugger:
这篇关于Facebook不到期访问令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!