'Facebook Marketing/Insights API returns OAuthException with error code 100 missing permissions
Lately, the Facebook Marketing API throws an OAuthException error with code 100/missing permissions. When looking into the Facebook Developer App, nothing indicates that the permissions are missing or not configured properly. The permissions needed for the Insights API (ads_read) is active and currently at Standard Access (which should be sufficient).
I've also validated my token with the Access Token debugger, but it's valid nonetheless. I am using the Python facebook-business SDK 12.0.1 to make the call to the Insights endpoint:
params = {
'time_range': {'since' : self.time_range, 'until' : self.time_range},
'breakdowns' : self.breakdowns,
'fields': self.fields,
'filtering' : self.filtering,
'level': self.level,
'limit' : self.limit
}
response = my_account.get_insights(params=params)
The full error code:
Message: Call was not successful
Method: GET
Path: https://graph.facebook.com/v12.0/{ad_account_id}/insights
Params: {'time_range': '{"since":"2021-10-28","until":"2021-10-28"}', 'breakdowns': '["publisher_platform","platform_position"]', 'fields': '["campaign_name","clicks","spend","impressions","date_start","campaign_id","adset_id","ad_id","adset_name","ad_name","link_url"]', 'filtering': '[{"field":"ad.impressions","operator":"GREATER_THAN","value":"0"}]', 'level': 'ad', 'limit': '100000'}
Status: 400
Response:
{
"error": {
"message": "(#100) Missing permissions",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "AZhZZ3O_3iRkR4nObcyU-yB"
}
}
My current assumption is that something is wrong with the FB Marketing API. Or is it?
Solution 1:[1]
I had this same problem. I found this helpful re: the access token. https://github.com/fbsamples/messenger-platform-samples/issues/125
In my case I needed to use the PAGE_ACCESS_TOKEN instead of the access_token acquired by hitting "https://graph.facebook.com/oauth/access_token?client_id=<app_id>&client_secret=<app_secret>&grant_type=client_credentials"
Of course this is clear as mud in facebook's documentation.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | AndyK |