3

If I have the publish_stream extended permission for a Facebook app, does that allow my app to write on my feed while I'm offline?

Thanks,
Tee

teepusink
  • 27,444
  • 37
  • 107
  • 147
  • possible duplicate of [Publishing To User's Wall Without Being Online/Logged-in - Facebook Sharing Using Graph API](http://facebook.stackoverflow.com/questions/4814432/publishing-to-users-wall-without-being-online-logged-in-facebook-sharing-using) – ifaour Oct 02 '11 at 22:03

4 Answers4

8

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

bovine
  • 5,303
  • 2
  • 18
  • 17
Johnny Oshika
  • 54,741
  • 40
  • 181
  • 275
  • I can verify it works, more info: https://developers.facebook.com/docs/authentication/ – Macario Mar 13 '11 at 01:16
  • 1
    Phillip, there are 2 steps. Which one didn't work for you and what error message are you getting from Facebook? I just did it using Fiddler and it worked for me. – Johnny Oshika Oct 07 '11 at 15:26
2

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'
                                  ));
evanmcd
  • 1,967
  • 3
  • 32
  • 52
1

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

Shreeyansh Jain
  • 1,407
  • 15
  • 25
  • About publish_stream permission: ...With this permission, you can publish content to a user's feed at any time, without requiring offline_acces... so apparently no offline_access permission is needed.Only doesn't say how. – Macario Mar 13 '11 at 00:46
0

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/

Tarek El-Mallah
  • 4,015
  • 1
  • 31
  • 46