且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用 Facebook Graph API 获取公共页面状态,无需访问令牌

更新时间:2023-02-24 11:12:51

这是设计使然.曾经可以在没有访问令牌的情况下从公共页面获取最新状态.这是为了阻止对 API 的身份不明的匿名访问而改变的.您可以使用图形 API 通过以下调用获取应用程序的访问令牌(如果您没有为您的网站设置 Facebook 应用程序 - 您应该创建它):

This is by design. Once it was possible to fetch the latest status from a public page without access token. That was changed in order to block unidentified anonymous access to the API. You can get an access token for the application (if you don't have a Facebook application set for your website - you should create it) with the following call using graph API:

https://graph.facebook.com/oauth/access_token?
client_id=YOUR_APP_ID&client_secret=YOUR_APP_SECRET&
grant_type=client_credentials  

这称为应用访问令牌.然后您使用上面的应用程序访问令牌继续实际的 API 调用.

This is called App Access Token. Then you proceed with the actual API call using the app access token from above.

希望能帮到你