Posts tagged with facebook-access-token

I have a Facebook app running in production, and I've created a system user within Facebook Business Manager. After generating a system user access token, I have also generated a user access token for the system user. However, the API response only returns the page ID and not the page access token. What steps should I take to ensure that the system user has the necessary permissions, and how can I retrieve the page access token successfully?

I generated a system user access token and used it to call the Facebook Graph API to retrieve the page access token. I expected the API to return the page access token, but instead, it only returned the page ID. I was expecting the access_token field in the response but did not receive it.

Here is the CURL used to fetch the page access token :

curl -X GET "https://graph.facebook.com/v19.0/{page_id}?fields=access_token&access_token={user_access_token_or_system_user_access_token}"

I'm working on an app using the Threads API from meta. I have created the application successfully on the developer console, and am trying to test access using the Graph API Explorer. I've selected "threads.net" from the endpoint dropdown, and the application I created from the "Meta app" dropdown, but when I try to generate an access token, the approval window appears, I click continue, and then it just says "URL Blocked"

Is there something I'm missing?

  1. I have created the app.
  2. I used the short-lived user access token to get a long-lived user access token.
  3. Then I tried to exchange the long-lived user access token for a long-lived page access token.
  4. This is the response I am getting:
    {      "error": {         "message": "(#15) This method must be called with an app access_token.",         "type": "OAuthException",         "code": 15,         "fbtrace_id": "AaKKgfwJzZsNDXADht1N7wy"      }     } 
  1. This is the endpoint for the API call to receive a long-lived page access token:
https://graph.facebook.com/v19.0/{app-id}/accounts?access_token={long-lived-user-access-token} 
  1. The endpoint for long-lived user access token:
https://graph.facebook.com/v19.0/oauth/access_token?grant_type=fb_exchange_token&client_id={app-id}&client_secret={app-secret}&fb_exchange_token={short-lived-user-access-token} 
  1. According to this documentation, I need to exchange a long-lived user access token in order to get a long-lived pages access token: Facebook Developer Documentation

Making get request for creating page-access-token for facebook graph API returns blank data object.

The request is like below according to the official doc:https://developers.facebook.com/docs/facebook-login/guides/access-tokens/#pagetokens

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

This worked at least half years ago, now the request returns blank data[] object. I tried both curl command line and Graph API Explorer.

On Graph API Explorer, Submiting GET https://graph.facebook.com/{version}/{App-Scoped User ID}/permissions returns

{   "data": [     {       "permission": "pages_show_list",       "status": "granted"     },     {       "permission": "pages_read_engagement",       "status": "granted"     },     {       "permission": "pages_read_user_content",       "status": "granted"     },     {       "permission": "public_profile",       "status": "granted"     }   ] } 

But submiting GET https://graph.facebook.com/{version}/{App-Scoped User ID}/accounts returns

{   "data": [   ] } 

Any ideas to solve this issue?


[updated 1] I found the request works for another facebook account. I don't understand why for some accounts request returns blank data(i.e. blank page access token). The user account which fails to create page access token now is the one which could create access tokens last year.

[update 2-A] I checked differences between working example and failed one, and found that requested pages_read_user_content looks like canceled or ignored for the failed one. On graph explorer, after doing "get page access token", pages_show_list and pages_read_engagement are successfully added, but pages_read_user_content is pending with green-colored text. I think this is a hint of this issue, and this article may be related. [updated 2-B] I found another difference about them. After deactivating all permissions for the page on Business Integrations, the pending issue is solved, but the main issue is not solved, so pages_read_user_content seems to be not related to this issue.

[updated3 and solved] I found unofficial tips here. The solution process is a little bit tricky, first you have to run the Delete permission command like this:DELETE https://graph.facebook.com/{version}/{App-Scoped User ID}/permissions and deactivate the app for the facebook page on Business Integrations(after clicking View and edit button for the app, toggle and deactivate all of the WHAT BUSINESS FEATURES CAN BE MANAGED section). Once that's done, you create tokens again from scratch.

I have created a page named Test 1. When I go to Business Suite, my Business Portfolio and add the page Test 1 to Account -> Pages. After adding the page successfully I see page access section where I have full control over the page Test 1.

But after giving permission to the page Test 1 from the Developer app I am unable to generate page information like Page name, page id, access token etc... But when I remove the page from Meta Business Suit/Business Portfolio and again give the permission to the page from the developer app then I am able to generate the page details like access token, name and id.

My question is why I am unable to generate page details from graph api if the page is added to facebook business portfolio?

I have tried multiple time, but when the page is added to Meta Business Portfolio then I am unable to generate page details like id,name and access token