9

I've been struggling with the graph api since this morning.

I'm trying to post a message to my facebook page, but NOT as the page, as myself (user).

When i try to post to a friend's page everything works fine and the message is posted, but when i try to post to my page (i'm an admin) it asks for manage_pages permission, and if i give this permission it will only post the message AS the page, not as myself !

Is there a way to specify that: yes i want to post to my page's wall, yes i'm the admin, but i want to post as a user ?

public function postToWall($pageId, $msg) {
    if($pageId) {
        $this->callAPI('/'.$pageId.'/feed', 'POST', array(
            'message' => $msg
        ));
    }
}

/**
 * @param $path
 * @param string $method default to GET
 * @param array $params additional params
 * @return mixed
 */
public function callAPI($path, $method = 'GET', $params = array()) {
    $params = array_merge(array('access_token' => $this->getAccessToken()), $params);
    return $this->api($path, $method, $params);
}

It returns:

Uncaught OAuthException: (#283) Requires extended permission: manage_pages

I've checked and the access_token is my user access token.

I have the "publish_stream" permission.

Any help would be appreciated ! Thanks

Somnath Muluk
  • 55,015
  • 38
  • 216
  • 226
Olivier
  • 1,270
  • 1
  • 10
  • 24

2 Answers2

0

Try requesting 'publish_actions' permission. Also make sure you are using page as user not page itself on the Facebook.

raevilman
  • 3,169
  • 2
  • 17
  • 29
-2

In FB docs You can read about publish_stream:

"Enables your app to post content, comments, and likes to a user's stream and to the streams of the user's friends."

So this permission cant give Your app access to publish on page wall. You must use "manage_pages" permission. Here is more information:

https://developers.facebook.com/docs/reference/login/page-permissions/

Boogeroos
  • 104
  • 5
  • As mentioned in my post, I tried posting to the page of a friend (not his wall, a public page he owns) and it worked fine. You can see in the doc that publish_stream is used to post to a page: This method works in two ways. You can use it to publish: [...] Directly to a user's or Page's stream, without prompting the user. Before your application can publish directly to the stream, the user or Page must grant your application the publish_stream extended permission. It is in the doc for the JS function https://developers.facebook.com/docs/fbjs/streamPublish/ (but the php one works the same) – Olivier Nov 12 '12 at 09:51