I am building my first facebook app and am facing a issue.
Task : Build a entirely server side application to be used by the admin of a facebook page to post videos/photos on the page. This should not involve having the admin to log in everytime to generate the user acess and page access token.
What I found : Based on the requirement, I found that app tokens can be used for this purpose. This line specifically hints at the usefulness.
App access tokens can also be used to publish content to Facebook on behalf of a person who has granted an open graph publishing permission to your application
I think that using this will be safe since mine is an entirely server side app.
Problem The docs say that:
GET /oauth/access_token? client_id={app-id} &client_secret={app-secret} &grant_type=client_credentials
will give the app token that can be used in place of user access token. However, I have not been able to do so. Specifically the error encountered is Error 200 .The user must have accepted the TOS. Since I have already tried publishing content with page access token, I know this is a permission issue.
The following line
a person who has granted an open graph publishing permission to your application.
does not clarify everything. I came across a related question, but the answers seem to be a bit vague.
It would be really great if someone could give me insights about how this can be achieved.
In order to post to a page, you need at least authorize with the
manage_pages
permission. If you want to post "as user", you need to addpublish_actions
and use a "User Access Token". If you want to post "as page", you need to addpublish_pages
and use a "Page Access Token".Information about how to generate those Tokens:
The error message with the TOS has been discussed a lot of times already, please go to those threads (or find a lot more with the search function):