如何通过图形浏览器检索页面的长期访问令牌? [英] How can long-lived access token be retrieved for a page via graph explorer?
问题描述
我想允许一个应用程序作为一个页面发布,所以我使用图形API来访问页面,但它有一个小时到期。
I want to allow an app to post as a page, so I used graph api to get access token to the page but it has one hour expiry.
有没有办法通过图形API获取长期访问令牌?
Is there a way to retrieve long term access tokens via graph api?
我尝试使用端点与长期访问令牌进行交换,并且获得OAuth错误。
P.S. I tried to use the endpoint for exchanging the short term access token with long term one and am getting OAuth error.
推荐答案
您可以有一个永不过期的令牌为您的粉丝页面。按照简单的步骤:
You can have a never expiring token for your fan page. Follow the simple steps:
-
获取管理员(即您的)扩展令牌(2个月有效期)。通过链接获取扩展令牌。以完美的方式工作:
Get the admin's(i.e. yours) extended token (2 months validity). Go though the link to get the extended token. Works with perfection:
使用此令牌,获取页面/应用程序 -
Using this token, Get the list of pages/apps-
$facebook->api("/USER_ID/accounts");
获取任何页面永不过期的访问令牌 -
Get the never expiring access token for any page-
$facebook->api("/PAGE_ID?fields=access_token");
(您可以使用 Facebook的调试工具来检查令牌的有效性。)
(You can use Facebook's Debug Tool to check the validity of the token.)
这篇关于如何通过图形浏览器检索页面的长期访问令牌?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!