使用没有访问令牌的 Facebook Graph API 获取公共页面状态

问题描述:

我正在尝试使用 Facebook Graph API 从公共页面获取最新状态,比如 http://www.facebook.com/microsoft

I'm trying to use the Facebook Graph API to get the latest status from a public page, let's say http://www.facebook.com/microsoft

根据 http://developers.facebook.com/tools/explorer/?method=GET&path=microsoft%2Fstatuses - 我需要一个访问令牌.由于 Microsoft 页面是公开的",是否确实如此?如果没有访问令牌,我就无法访问这些公共状态吗?

According to http://developers.facebook.com/tools/explorer/?method=GET&path=microsoft%2Fstatuses - I need an access token. As the Microsoft page is 'public', is this definitely the case? Is there no way for me to access these public status' without an access token?

如果是这种情况,为我的网站创建访问令牌的正确方法是什么?我有一个应用程序 ID,但是 http://developers.facebook.com/docs/上的所有示例authentication/ 描述处理用户登录.我只想在 Microsoft 页面上获取最新状态更新并将其显示在我的网站上.

If this is the case, how is the correct method of creating an access token for my website? I have an App ID, however all of the examples at http://developers.facebook.com/docs/authentication/ describe handling user login. I simply want to get the latest status update on the Microsoft page and display it on my site.

这是设计使然.曾经可以在没有访问令牌的情况下从公共页面获取最新状态.这是为了阻止对 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.

希望能帮到你