Issue
I need to post messages on a Facebook page. Specifically I want to post via cron
.
Here's what the API docs say:
Page Access Token – These access tokens are similar to user access tokens, except that they provide permission to APIs that read, write or modify the data belonging to a Facebook Page. To obtain a page access token you need to start by obtaining a user access token and asking for the manage_pages permission. Once you have the user access token you then get the page access token via the Graph API.
How I can obtain a user access and page access token without a page callback? Is this possible?
Solution
What you need it an Extended Page Token, it is valid forever. You get one like this:
- Authorize with the
manage_pages
permission (andpublish_pages
if you want to post as Page later), to get a User Token - Extend the User Token
- Use
/me/accounts?fields=access_token
with the Extended User Token to get a list of all your Pages with Extended Page Tokens - or use/page-id?fields=access_token
to get an Extended Page Token for a specific Page
Information about all Tokens and how to extend the User Token:
- https://developers.facebook.com/docs/facebook-login/access-tokens#extending
- http://www.devils-heaven.com/facebook-access-tokens/
Answered By - andyrandy
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.