简体   繁体   中英

Facebook-sdk Gives “(#200) The user hasn't authorized the application to perform this action” on auto post with codeigniter

Here is the my code..

public function autopost(){

$this->load->library('facebook', array(
  'appId' => '15704450865*****',
  'secret' => '9ef9e145108f7331d677209b62c*****'
  ));

$user = $this->facebook->getUser();
$access_token = $this->facebook->getAccessToken();
$params = array(
  "access_token" => $access_token ,
  "message" => "my message goes here.",
  "link" => "http://www.sakkigoni.com/",
 // "picture" => "http://i.imgur.com/lHkOsiH.png",
  "name" => "How to Auto Post on Facebook with PHP",
  "caption" => "www.pontikis.net",
  "description" => " description goes here."
  );

if($user){
  try {

    $ret = $this->facebook->api('/me/feed', 'POST', $params);
    echo 'Successfully posted to Facebook Personal Profile';
  } catch(Exception $e) {
    echo $e->getMessage();
  }
}else{
  echo "<a href='".$this->facebook->getLoginUrl(array('scope'=>'email, publish_actions'))."'>Login with Facebook</a>";
}

}

when I run the above code and login on facebook to auto post.Only admin user of app is authorized to post in timeline but other user shows this error

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

i have tried these too but doesn't work in me

same #200 error

same #200 error

If it works for the App admin, but not for anyone else, you probably forgot to send publish_actions through review: https://developers.facebook.com/docs/facebook-login/review

Also, autoposting is not allowed and the message must be 100% user generated. You MUST read the platform policy before creating any App: https://developers.facebook.com/policy/

In other words: You will never get publish_actions approved for autoposting and a predefined message.

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