权限与Facebook登录- publish_actions权限没有得到

Permissions with Facebook Login - publish_actions permission not getting

本文关键字:权限 actions publish Facebook 登录      更新时间:2023-09-26

在我的网站,用户可以从我的网站发布到他们的FB墙。我用的是graphapi。我的api代码是,

       FB.api(
            "/me/photos",
            "POST",
            {
                "caption": "My caption",
                "url": "My image url"
            },
            function (response) {  console.log(response);
              if (response && !response.error) {
                $('#post_response').html('<a href="https://www.facebook.com/photo.php?fbid='+response.id+'" target="_blank">See feed</a>');
              }
            }
        );

在这个api调用中得到一个错误,

code: 200
message: "(#200) Requires extended permission: publish_actions"
type: "OAuthException"

我的Fb登录Api是,

    FB.login(function(response) {
        if (response.authResponse) {
            //user just authorized your app
            document.getElementById('loginBtn').style.display = 'none';
            getUserData();
        }
    },
      {
        scope: 'email,public_profile,publish_actions,manage_pages',
        auth_type: 'rerequest',
        return_scopes: true
      }
    );

我也试过了,

1)
FB.login(function(response) {
        if (response.authResponse) {
            //user just authorized your app
            document.getElementById('loginBtn').style.display = 'none';
            getUserData();
        }
    },
      {
        scope: 'publish_actions'
      }
    );

2)
FB.login(function(response) {
        if (response.authResponse) {
            //user just authorized your app
            document.getElementById('loginBtn').style.display = 'none';
            getUserData();
        }
    },
      {
        scope: 'publish_actions',
        auth_type: 'rerequest'
      }
    );
通过调用api,
FB.api("/me/permissions", function (response) {
    console.log(response);
});

我明白了,只有'email,public_profile'权限。

如何获得'publish_actions'权限??

是否有其他方法可以做到这一点?我想张贴图片张贴到用户墙和用户页…

请帮我解决这个问题…

请确保您已在FB应用程序设置>测试用户下添加FB帐户以测试用户。因为为了使用像publish _action这样的权限,你的应用程序需要得到Facebook的批准,但有了测试用户,你就可以测试功能了。