0

I'm trying to figure out a core concept in FB that even after reading a lot of FB documentation, couldn't understand. Let's say I'm building an app (that will reside in a tab), in which I want to see the last post of a user. I want to do this approximately one month after the user approved my app, without him using the app again.

I assume I will need to use a long-lived expiration token that will be saved to my DB. A month after I will run a procedure that will use this token and check the user posts.

Is this correct? What about a situation in which the user logged out? The token is no longer valid.. does this mean I will never be able to access user posts unless he will access my app? Isn't this a bit weird (since he already approved my app)?

4

1 回答 1

0

不必要。

首先,read_stream当用户对您的应用进行身份验证时,您需要获得用户的许可。然后,因为您打算将 Facebook 用作应用程序,而不是用户,所以您需要作为应用程序进行身份验证,这是一个简单的过程:

为了获得应用程序的访问令牌,您需要做的就是使用以下 URL: https://graph.facebook.com/oauth/access_token?client_id=YOUR_APP_ID&client_secret=YOUR_APP_SECRET&grant_type=client_credentials

由于这些令牌是有时间限制的,因此每次使用 Graph API 时请求令牌可能会更容易,而不是将其存储在数据库中并等待它过期。

然后,您需要做的就是使用以下请求: https://graph.facebook.com/USER_ID/feed?access_token=YOUR_ACCESS_TOKEN

这样做的好处是,用户是否登录 Facebook 并不重要。

有关更多详细信息,请参见此处: https ://developers.facebook.com/docs/authentication/applications/

于 2012-09-11T15:04:34.240 回答