未捕获OAuthException:(#200)用户尚未授权应用程序执行此操作

时间:2011-09-16 09:18:55

标签: facebook facebook-graph-api

我正试图发布到我的Facebook群组墙,但我继续收到上述错误。谁能告诉我这里可能做错了什么?我检查了Facebook文档,但我似乎仍然无法自己修复它。我的代码如下:

$facebook = new Facebook(array(
  'appId' => $app_id,
  'secret' => $app_secret,
  'perms' => 'offline_access, user_groups, publish_stream',
  'cookie' => true
));


$result = $facebook->api(
     '/xxxxxxxxxgroupid/feed/',
      'post',
      array('access_token' => $facebook->getAccessToken(), 'message' =>  'Playing around with FB Graph..')
);

2 个答案:

答案 0 :(得分:0)

我认为您需要user_groups扩展权限。

答案 1 :(得分:0)

使用之前尝试,这样可以正常工作

try {
        $params = array(
            'message'       =>  "Hurray! This works :)",
            'name'          =>  "This is my title",
            'caption'       =>  "My Caption",
            'description'   =>  "Some Description...",
            'link'          =>  "http://stackoverflow.com",
            'picture'       =>  "http://i.imgur.com/VUBz8.png",
        );

        $post = $facebook->api("/$user/feed","POST",$params);

        echo "Your post was successfully posted to UID: $user";

    }
    catch (FacebookApiException $e) {
       $result = $e->getResult();
    }