使用没有访问令牌的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 - 我需要一个访问令牌。由于微软的网页是公开的,这是绝对的吗?没有访问令牌,我无法访问这些公共状态?

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/身份验证/ 描述处理用户登录。我只想在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的不明身份的匿名访问。您可以获得应用程序的访问令牌(如果您没有为您的网站设置一个Facebook应用程序 - 您应该创建它),并从图形API中获得以下呼叫:

This is by design. Once it was possible to fetch it from public pages without access token but it 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 from graph API:

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

然后您继续执行具有此访问令牌的实际API调用。

then you proceed to the actual API call having this access token.

希望这有助于