At first I am sorry for post the old post, but I don't know why I didn't make it correctly.
I post new feed into facebook fan page as admin. I have search many threads before and I fixed as they comments.
- I have correct permissions for post page.
- I have PAGE access_token for page.
- I have tried logged out and in many times.
- I have tried post feed in page manually as page admin (Successful).
But I still post as visior not admin in page.
Those are my functions:
var page_id = [
'88290XXXXXX39694', //fan page 1
'17537XXXXXX02244', //fan page 2
];
var permission = 'publish_actions, publish_pages, manage_pages, user_events, publish_stream';
function postFB(id, title, desc) {
var title = title;
var desc = desc;
var body = title+"/n"+desc;
var video_link = 'https://youtu.be/'+id+'';
for(var i = 0; i<= page_id.length; i++ )
{
var accessToken = "";
FB.api('/'+page_id[i]+'?fields=access_token', function(response) {
accessToken = response.access_token;
});
FB.api('/'+page_id[i]+'/feed', 'post', {
message: body,
link: video_link,
access_token: accessToken
}, function(response) {
if (!response || response.error) {
console.log(response);
} else {
alert('Post ID: ' + response.id);
}
});
}
};
function publish(id, title, decs)
{
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 + '!';
});
postFB(id, title, decs);
} else {
console.log('User cancelled login or did not fully authorize.');
}
}, {
scope: permission,
return_scopes: true
});
};
Any suggesstion for my issue?