admin管理员组文章数量:1389952
I want to post to a Facebook Page feed from JavaScript (as if it were from the page). I log in OK, but when i try to post, it gives the error
"error: Object code: 200 message: "(#200) Permissions error" type: "OAuthException"
In the login, the auth response es through with the following permissions which i believe are sufficient -
"email,contact_email,manage_pages,publish_pages,publish_actions,public_profile"."
How can i get this working please?
Main Parts (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});
};
For info, I have looked at the docs here, here, and here and many StackOverflow posts but can't get it going.
I want to post to a Facebook Page feed from JavaScript (as if it were from the page). I log in OK, but when i try to post, it gives the error
"error: Object code: 200 message: "(#200) Permissions error" type: "OAuthException"
In the login, the auth response es through with the following permissions which i believe are sufficient -
"email,contact_email,manage_pages,publish_pages,publish_actions,public_profile"."
How can i get this working please?
Main Parts (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});
};
For info, I have looked at the docs here, here, and here and many StackOverflow posts but can't get it going.
Share asked Sep 5, 2015 at 14:39 JJJCoderJJJCoder 17k19 gold badges105 silver badges130 bronze badges 1- Check this answer: stackoverflow./a/78798556/15256130, it might be helpful – Obada Jaras Commented Jul 26, 2024 at 14:20
1 Answer
Reset to default 2There is no permission called "contact_email", there is only "email".
That being said, you need a Page Token to post "as Page". Use /me/accounts
to get Page Tokens for your Pages. The permission error most likely means that you don´t have the appropriate permissions to post to the Page with your Access Token. Make sure it is a Page you manage, and make sure the Access Token includes the publish_pages
permission. You can debug your Access token in the Debugger: https://developers.facebook./tools/debug/
Also, make sure you are trying with an App Admin. Without review, those additional permissions only work for Users with a role in the App. See information about Login Review in the docs: https://developers.facebook./docs/facebook-login/review
本文标签: javascriptFacebook Graph API(200) Permissions error on Page PostStack Overflow
版权声明:本文标题:javascript - Facebook Graph API - (#200) Permissions error on Page Post - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744649949a2617625.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论