I am trying to get a page access token of a facebook page using its graph api for posting anything in that page.
From https://developers.facebook.com/tools/explorer I can get the page access token and then I can post on the page using it.
I go through all the similar question answer of stack overflow. but failed.
Here is my details flow
Firstly for code - my_codehttp://www.facebook.com/dialog/oauth?client_id=&redirect_uri=&scope=email
I get the user_access_token going through this
https://graph.facebook.com/oauth/access_token?client_id=my_app_id&client_secret=my_app_secret&redirect_uri=my_redirect_url&code=my_code
Then for long lived token
https://graph.facebook.com/oauth/access_token?grant_type=fb_exchange_token&client_id=my_app_id&client_secret=my_app_secret&fb_exchange_token=my_user_access_token
After getting the my_user_access_token_long I request for page access token
https://graph.facebook.com/me/accounts?access_token=my_user_access_token_long
it returns
{"data":[]}
If I try https://graph.facebook.com/my_page_id?fields=access_token&access_token=my_access_token_long
it returns only my page id
{ "id": "my_page_id" }
Please help me to solve this issue. Thanks in advance.
You need to add manage_pages
permission in the first step
http://www.facebook.com/dialog/oauth?client_id=&redirect_uri=&scope=email,manage_pages
See Page Access Tokens in the documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With