1

I am working on an app where one of the things that I want to do is publish a status on behalf of a user, offline. That is when the user is not using the app. The facebook's documentation is not clear about validity of access tokens, type of access token required for particular call(like publish stream), how to renew it, etc. I am using PHP Facebook SDK. It has a function setExtendedAccessToken(). But it is for extending the short-lived access token obtained by the client side for 60days(with some exception cases ofcourse). What if I have a long-lived access token that I obtained via server-to-server call. More specifically, by calling the $facebook->getAccessToken() method. I am using the following code to post in offline mode.

$req =  array(
'access_token' => $access_token, //stored in db, obtained thru getAccessToken()
'name' => "Awesome Status!",
'link' => "apps.facebook.com/myapp",
'description' => "Some Description",
'picture'=>"xxx.jpg",
'caption' => "Caption this"
);
$res = $facebook->api("/$userid/feed", 'POST', $req);

Thanks!

Addition:

Tried using setExtendedAccessToken function, but it doesn't change anything. I even checked the access tokens information here. I think it works for with the short-lived, client side generated token.

4

1 回答 1

3

您可以使用App Access Token (APP_ID|APP_SECRET)代用户离线发布;一旦用户授权您的应用程序。

于 2013-09-13T16:18:04.023 回答