简体   繁体   中英

Facebook API Uncaught OAuthException: (#200)

I'm trying to verify following's link facebook. I need that user can't access to information without follow "X".

My problem is with permissions, I give to the app "publish_actions'permisions but I obtaint this error:

Uncaught OAuthException: (#200) Requires extended permission: publish_actions thrown in...

This is my code:

require_once("./facebook/facebook.php");

$config = array();
$config['appId'] = '';
$config['secret'] = '';
$config['fileUpload'] = false; // optional

$facebook = new Facebook($config);

if ( $facebook->getUser() )
    echo '<a href="'. $facebook->getLogoutUrl() . '">Cerrar sesión en Facebook</a>';
else
    echo '<a href="'. $facebook->getLoginUrl() . '">Iniciar sesión en Facebook</a>';


echo '<pre>';
var_dump($facebook->api('/me/og.likes','POST',array('object' => "http://samples.ogp.me/226075010839791")));
echo '</pre>';

The parameters for getLoginUrl are empty. It should be as follows

$params = array(
  'scope' => 'publish_actions'
);

echo '<a href="'. $facebook->getLoginUrl($params); . '">Iniciar sesión en Facebook</a>';

See https://developers.facebook.com/docs/reference/php/facebook-getLoginUrl/ and https://developers.facebook.com/docs/facebook-login/permissions/#adding

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