Facebook图形API - (#200)页面上的权限错误发布
问题描述:
我想从JavaScript发布到Facebook页面源(就好像它是从页面发布的)。我登录OK,但是当我尝试后,它给出了错误Facebook图形API - (#200)页面上的权限错误发布
"error: Object code: 200 message: "(#200) Permissions error" type: "OAuthException"
在登录中,auth响应来通过与下面的权限,我相信有足够 -
"email,contact_email,manage_pages,publish_pages,publish_actions,public_profile"."
如何我可以得到这个工作吗?
主要部件(plunk):
function postToMembers(){
var access_token1 = FB.getAuthResponse()['accessToken'];
var body = 'Post from code test';
FB.api('/41622-PAGEID-34/feed', 'post', { message: body, access_token: access_token1 }, function(response) {
if (!response || response.error) {
console.log(response);
} else {
alert('Post ID: ' + response.id);
}
});
};
function loginAndPost(){
FB.login(function(response) {
if (response.authResponse) {
//Log auth permissions (in the response)
console.log(response);
FB.api('/me', function(response) {
console.log('Successful login for: ' + response.name);
document.getElementById('status').innerHTML =
'Thanks for logging in, ' + response.name + '!';
});
postToMembers();
} else {
console.log('User cancelled login or did not fully authorize.');
}
}, {scope: 'publish_actions,publish_pages,manage_pages', return_scopes: true});
};
答
没有称为“contact_email”的权限,只有“email”。
这就是说,你需要一个Page Token来张贴“作为页面”。使用/me/accounts
获取页面的页面令牌。权限错误最有可能意味着您没有适当的权限,无法使用您的访问令牌发布到网页上。确保它是您管理的网页,并确保访问令牌包含publish_pages
权限。您可以在调试器中调试您的Access令牌:https://developers.facebook.com/tools/debug/
此外,请确保您尝试使用应用管理员。未经审核,这些附加权限仅适用于在应用中拥有角色的用户。在文档中查看关于登录审查的信息:https://developers.facebook.com/docs/facebook-login/review