21

I am working on a project to post data to the walls of Facebook pages. I have set up a Facebook app and currently requesting the following permissions from user when attempting to post to their page's wall:

  • publish_stream
  • offline_access
  • manage_pages

The code currently posts to a PROFILE's wall successfully, but when trying to post to a PAGE's wall, the following error is returned:

Facebook error: (#200) The user hasn't authorized the application to perform this action.

Again, I am requesting permissions which apparently are sufficient for posting to a profile's wall, but not to a page's wall. Which permission(s) am I missing for posting to a page's wall? Thank you in advance for any help.

Giulio Muscarello
  • 1,312
  • 2
  • 12
  • 33
Sean
  • 1,110
  • 1
  • 14
  • 24
  • Need more info. What a protocol (API) do you use? Did you recieve access tokens for pages? Is user administrator of page you try to connect? – Lex Dec 13 '10 at 19:21
  • I am using the OAuth 2.0 protocol to acquire the access tokens and am using the Graph API to post the data, making a curl request to "https://graph.facebook.com/".$facebookPageID."/feed" to post the data to the wall belonging to $facebookPageID. I have received access tokens for both the profile's wall and the page's wall. The page is managed by the user whose profile I posted to, and Facebook returned the same access token for both pages. The access token was granted by signing into the account of the administrator of the page. Thank you very much for your time and help. – Sean Dec 13 '10 at 21:01

2 Answers2

12

here's what you do. First, read the documentation on extended permissions. Notice that 'manage_pages' says:

Enables your application to retrieve access_tokens for pages the user administrates. The access tokens can be queried using the "accounts" connection in the Graph API. This permission is only compatible with the Graph API.

This means you have to switch your user's access token based on the response from the

https://graph.facebook.com/$USERID/accounts?access_token=$USER_ACCESS_TOKEN

for your app. So once you have your PAGE ACCESS TOKEN, switch the request to post your message like such:

https://graph.facebook.com/$PAGEID/feed

in postfields (using curl or some such), include your message and $PAGE_ACCESS_TOKEN

Derek Downey
  • 1,512
  • 2
  • 10
  • 16
  • 2
    I had to include the **status_update** permission (scope=publish_actions,manage_pages,status_update) in order to post to a FB page. I could not find this permission in any facebook docs. See http://stackoverflow.com/q/15796138/516910 I did _not_ have to "like" the page. – broc.seib Apr 11 '13 at 18:46
2

In order to POST to a user's wall you can use "publish_stream" permission but the same doesn't go with a Page. In order to POST to a Page's wall we need to first like the Page. (Become a Fan has now been removed by Facebook). The above answer is based on my experience with FBConnect (Facebook SDK for iPhone). In my application I had to use Like Button to let user first Like the Page and later he could POST on PAGE's wall. I was not able to find any specific permission for the same that could directly let user post to Page's wall after login. If you get any clue please let me know as well.

Rahul Sharma
  • 3,013
  • 1
  • 20
  • 47