skip to Main Content

I cannot seem to generate a page access token. I’ve tried using the Graph API Explorer by selecting "Get Page Access Token" from the User or Page dropdown, but it opens a window with the following error:

enter image description here

I’ve also tried sending the following API request but even though it returns a 200 OK status code, the content is an empty array!

curl -i -X GET "https://graph.facebook.com/{your-user-id}/accounts?access_token={user-access-token} 

Result:

{"data":[]}

I’ve also tried to get the page access token with the following command:

curl -i -X GET "https://graph.facebook.com/v14.0/<page_id>?access_token=<user_access_token>&fields=access_token"

Result:

{"error":{"message":"(#100) Object does not exist, cannot be loaded due to missing permission or reviewable feature, or does not support this operation. This endpoint requires the 'pages_read_engagement' permission or the 'Page Public Content Access' feature or the 'Page Public Metadata Access' feature. Refer to https://developers.facebook.com/docs/apps/review/login-permissions#manage-pages, https://developers.facebook.com/docs/apps/review/feature#reference-PAGES_ACCESS and https://developers.facebook.com/docs/apps/review/feature#page-public-metadata-access for details.","type":"OAuthException","code":100,"fbtrace_id":"AIx208__9nozhxypMyxZYpy"}}

My user is listed as the admin for this page and I previously was able to create page access tokens simply by using the Graph API Explorer above.

In the Graph API Explorer, I don’t seem to have any such option for ‘pages_read_engagement.’

enter image description here

How can I generate a page access token?

Note: I’ve also asked this question on the Facebook Developer Community Forum but no one has answered yet. This seems like a simple question so I’m surprised I’ve not gotten any responses thus far. https://developers.facebook.com/community/threads/911494286473743/

Ref. https://developers.facebook.com/docs/facebook-login/guides/access-tokens#pagetokens

2

Answers


  1. If you’re admin and you’ve Facebook Page ID of the page you need access token then you can use following API to fetch page access token –

    curl --location --request GET 'https://graph.facebook.com/v14.0/<page_id>?access_token=<user_access_token>&fields=access_token'
    

    You can also use Graph API Explorer to fetch the same using user token.

    Login or Signup to reply.
  2. Ask for the permission business_management access permission. There is not a word about this in the docs, but it fixed it for me.

    My problem started occurring after I became a full admin in meta business manager.

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search