dtbrd80422 2016-08-17 07:08
浏览 117

Facebook-sdk给出了“(#200)用户没有授权应用程序执行此操作”在带有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

  • 写回答

1条回答 默认 最新

  • douxia6163 2016-08-17 07:55
    关注

    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.

    评论

报告相同问题?

悬赏问题

  • ¥50 易语言把MYSQL数据库中的数据添加至组合框
  • ¥20 求数据集和代码#有偿答复
  • ¥15 关于下拉菜单选项关联的问题
  • ¥20 java-OJ-健康体检
  • ¥15 rs485的上拉下拉,不会对a-b<-200mv有影响吗,就是接受时,对判断逻辑0有影响吗
  • ¥15 使用phpstudy在云服务器上搭建个人网站
  • ¥15 应该如何判断含间隙的曲柄摇杆机构,轴与轴承是否发生了碰撞?
  • ¥15 vue3+express部署到nginx
  • ¥20 搭建pt1000三线制高精度测温电路
  • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况