简体   繁体   中英

Share post via facebook php sdk version 4.0.9, Graph API v2.0

Using facebook php sdk version 4.0.9 & Graph API v2.0

Here is my application settings for publishing post. 在此处输入图片说明

My code is :

$requestjojo = new FacebookRequest($session, 'POST', '/me/feed', array('message' => 'testing'));
$responsejojo = $requestjojo->execute();

// get response
$graphObjectjojo = $responsejojo->getGraphObject()->asArray();

// print Graph data
echo '<pre>' . print_r( $graphObjectjojo, 1 ) . '</pre>';

This is not working for me, I want to know where's the bug.

Note : I am getting user data(user profile) properly from this sdk.

Using echo '<a href="' . $helper->getLoginUrl(array('publish_stream')).'" target="_top">Login</a>';

for login button, when login with Facebook, Facebook is not asking me for this extended permission(publish_stream) too.

The loginUrl is not build up properly.

 $helper->getLoginUrl(array(
    'scope' => 'publish_stream',
    'redirect_uri' => $your_redirect_uri
 ));

Finally, got the answer.

The reason is that "publish_stream" is now deprecated; use "publish_actions" instead.

From :

Error (#200) The user hasn't authorized the application to perform this action

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM