开发者

Facebook Stream Publish while offline

If I have the publish_stream extended p开发者_开发技巧ermission for a Facebook app, does that allow my app to write on my feed while I'm offline?

Thanks,

Tee


You don't need the offline_access permission to post to a user's feed, so long as you have the publish_stream permission. Here's an excerpt from the "publish_stream" section of Facebook's Doc :

publish_stream With this permission, you can publish content to a user's feed at any time, without requiring offline_access.

To do this, you need to first retrieve your app's access token by calling this API:

GET URL https://graph.facebook.com/oauth/access_token?client_id={app_id}&client_secret={app_secret}&grant_type=client_credentials

Once you have the app access_token, you can post to the user's feed:

POST URL https://graph.facebook.com/{user_id}/feed

POST BODY access_token={app_access_token}&message=Hello


Just in case anyone stumbles on this looking for a solution using PHP. Using the PHP API, I ended up with this working for me, with help from the FB docs here:

http://developers.facebook.com/docs/reference/php/facebook-api/

Note that $users_facebook_id is the Facebook ID of a user who has granted your app permissions with the "publish_stream" permission.

$access_token = $facebook->getAccessToken();

$ret_obj = $facebook->api('/'.$users_facebook_id.'/feed', 'POST',
                                    array(
                                   'link' => 'http://www.website.com',
                                   'message' => 'Testing'
                                  ));


yes facebook allow you to publish offline just take the offline_access permission from the user and when he/she is going to use you application , then user need not to be login on facebook to publish . please refer this :

http://developers.facebook.com/docs/authentication/permissions


offline_access is no longer used in facebook, the new way is the Expiration Time of the TOKEN through New Endpoint read more at https://developers.facebook.com/roadmap/offline-access-removal/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜