使用fb.api发布到Facebook页面 - 没有足够的权限代表查看者发布到目标

时间:2014-05-05 16:15:47

标签: javascript jquery facebook facebook-graph-api sdk

我可以获取用户的访问令牌并将其传递给post_to_page函数。它返回以下错误:

对象{message:“(#200)没有足够的权限代表观众发布到目标”,输入:“OAuthException”,代码:200}

我知道app_id很好,我将权限范围设置为:email,user_likes,publish_actions,publish_stream。我缺少一个允许代表观众发布的许可吗?

我觉得我错过了一件事。

$('a.post-to-page').click(function(event) {

     FB.login(function(response) {
       if (response.authResponse) {
         console.log('Welcome!  Fetching your information.... ');
         FB.api('/me', function(response) {
           console.log('Good to see you, ' + response.name + '.');
           console.log(response);

         });
       } else {
         console.log('User cancelled login or did not fully authorize.');
       }
     }, {scope: 'email,user_likes,publish_actions,publish_stream'});

     FB.getLoginStatus(function(response) {
        if (response.status === 'connected') {
        console.log(response.authResponse.accessToken);

        post_to_page(response.authResponse.accessToken);
      }
    });

});

function post_to_page(access_token_data)
{
    var body = 'Reading JS SDK documentation';

    FB.api('/page_id/feed', 'post', { message: body, access_token: access_token_data }, function(response) {
      if (!response || response.error) {
          console.log(response.error);
      } else {
        console.log(response.id);
      }

    });
}

0 个答案:

没有答案