0

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

Here is my application settings for publishing post.enter image description here

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.

Niko Jojo
  • 1,204
  • 2
  • 14
  • 31
  • What you get back in `$responsejojo`? – Stefan Jul 23 '14 at 09:39
  • 1
    Empty response. Nothing prints. – Niko Jojo Jul 23 '14 at 09:42
  • Try to rebuild your code first according to https://developers.facebook.com/docs/php/howto/postwithgraphapi/4.0.0 This example contains an error handler so you are able to see possible error messages. – Stefan Jul 23 '14 at 09:49
  • 1
    Stefan, edited question for login button extended permission. Also checked your suggestion, but still same empty response. – Niko Jojo Jul 23 '14 at 09:56

2 Answers2

0

The loginUrl is not build up properly.

 $helper->getLoginUrl(array(
    'scope' => 'publish_stream',
    'redirect_uri' => $your_redirect_uri
 ));
Stefan
  • 1,248
  • 6
  • 23
  • [error_code] => 100, [error_message] => Invalid Scope. -> it seems like "scope" is not require, because its already define in function. – Niko Jojo Jul 23 '14 at 10:26
0

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

Community
  • 1
  • 1
Niko Jojo
  • 1,204
  • 2
  • 14
  • 31