I have managed to post to Facebook Page via API (C#), but when administrator of the page logs out, the following error occurs:
\"(OAuthException - #190) Error valida
You need to get a user access token by FB.login() with manage_pages, pages_show_list and others in scope permissions. Then, execute FB.api("/{user-app-id}/accounts", fields: ...) to get a list of pages with their respectively info, including access_token. Here, you get a short-lived-token, but with this token you can extend its expiration time to "Never".
FB.login(function (response){
if(response.status!=="connected"){
return;
}
FB.api('/'+USER_APP_ID+'/accounts',{fields: 'id, name, access_token,category, picture'},
function(d){
console.log(d) // Here you get access_token (short-lived-token)
});
},{scope: 'manage_pages, pages_show_list', auth_type: 'rerequest'});
With the last access token and from server side, you make a call to API Graph, using App ID and App Secret of the App you use to get permissions to manage the page.
GET /oauth/access_token?
grant_type=fb_exchange_token&
client_id={app-id}&
client_secret={app-secret}&
fb_exchange_token={short-lived-token}
The response gives you an access token with expiration time in "Never".
References: API Graph Accounts, Expiration and Extends Access Tokens