Missing permissions error while trying to fetch ads data using API - facebook

We have an App that is connected to several advertising accounts. In the past, we used to use the app internally by our developers to fetch the ads data and use it internally for monitoring analysing purposes. We used to face some token expirations issues from time to time (we use long living user token) but we refresh the token and our job is able to refresh the token.
However, in the last month, our token is expired, and when we refresh the token and we try to fetch the data, we get the error: "(#100) Missing permissions".
Status: 400
Response:
{
"error": {
"message": "(#100) Missing permissions",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "-"
}
}
Despite that the permissions we are giving to our app are: read_insights, ads_management, ads_read, public_profile, and in the past used to work fine, but suddenly it's not working anymore.
We did some investigations, we found a lot of issues like those, but we couldn't find a solution. Also, our app is used internally within the company, by developers to fetch Ads data. Are we missing anything here? Can submitting an app review be a solution for the problem?

Related

How to get overall star rating of Facebook page from Facebook Graph API?

I am trying to make a very simple request to Facebook's Graph API using this URL:
https://graph.facebook.com/v2.12/1984193321812400?fields=overall_star_rating&access_token=205658113371329|gYdP-nDHNVENlwVxria21Uczgs8
All I want from Facebook is the overall_star_rating of my Facebook page. However, this is what I get:
{
"error": {
"message": "(#200) Access to this data is temporarily disabled for non-active apps or apps that have not recently accessed this data due to changes we are making to the Facebook Platform. https://developers.facebook.com/status/issues/206742313468873/",
"type": "OAuthException",
"code": 200,
"fbtrace_id": "A9XRfTkh3WR"
}
}
Since I am completely new to Facebook Graph API: Is the request I am making correct or am I missing something really fundamental here?
And yes, I read Facebook's issue report, but I don't find it very helpful since I set my app to active already and it's not working anyway.
Thanks for any help in this matter.
Since Facebook is undergoing major changes, they have revoked few access to non active apps. Get the access_token from any frequently used app, your Graph API call is pretty correct!
But the Page ID seems to be wrong, as it shows me error after adding a working token.
Error : "message": "(#803) Some of the aliases you requested do not
exist: 1984192327815400"
After changing the Page ID, and adding active app token, it shows the correct result.

Facebook Ads Insights API: (#3) Application does not have the capability to make this API call

I am trying to pull Facebook Ads metrics through the Facebook Marketing API. The flow is basically that I wish to pull all the account ids of my company, and then loop over them, retrieving the insights for them individually.
However I have an error which I am not able to solve/comprehend.
When I attempt to make the API call (both in the Graph Explorer and my Alteryx workflow):
GET-> /v2.8/act_<Account_ID>/insights
I get the following error:
"error": {
"message": "(#3) Application does not have the capability to make this API call.",
"type": "OAuthException",
"code": 3,
"fbtrace_id": "BNevVWUExDg"
}
I must admit that I am quite at a loss what is causing this error...and actually also exactly what the issue is...am I lacking the right scope/permissions for my token?
With the same token I am able to correctly call the API to get a list of all adaccounts (GET-> /v2.8/me/adaccounts ).
Anyone have an idea what my issue might be?
You have to make sure that your particular access token has the permissions ads_management or ads_read.
This is from the Marketing API quickstart. https://developers.facebook.com/docs/marketing-apis
There are also rate limits on those API's, but I would expect a different error if that was the case.
I ran a POST instead of GET on the same endpoints, which gives me another error about not being admin on the account.
It appears that the user associated with the token (which is a long lived one) was only having analyst access to the account in Business Manager. After I changed it to advertiser it seems I can do the GET call.
In my case, I added a new development user in the roles page. Then I was trying to do OAuth. I got the error message "Application does not have the capability to make this API call."
Here's the way that I solve the problem while your application still in the development mode.
Go to Marketing API > Tools
Then select what token permissions you want. Press "Get Token" button.
Now, you can try to do OAuth again.

Facebook Graph API "/{page-id}/feed" is not working with App Access Token

We are facing issues with Graph API. The Facebook Graph API "/{page-id}/feed" is not working for all pages with a valid App Access Token. Previously it used to work. We noticed it today the API is throwing error
{
"error": {
"message": "An unknown error has occurred.",
"type": "OAuthException",
"code": 1
}
}
Not working pages:
https://graph.facebook.com/22934684677/feed?access_token=
https://graph.facebook.com/42798291365/feed?access_token=
Note: And its working if we pass a User Access token instead of App Token.
Facebook developer Docs says "An access token is required to view publicly shared posts." So App Access Token should work!
Does Facebook change something inside the API?. Can any one help to solve the issue
You should use a Page Token for Page data. Pages not working with an App Token are most likely restricted by age or location. Since the App Token does not include any user session, you canĀ“t be sure if the user should have access to it.
If it does not work with an App Token AND the Page is definitely not restricted, file a bug.
This is happening because some of the posts returned might have extra restrictions on them which need a user token to verify this. Use a page token or a user token as a workaround for this. Having said that, the request shouldn't fail with an unknown error and we're working on a fix for the same on the bug report here:
https://developers.facebook.com/bugs/783169051760311/

Accessing Facebook Ads API request error 270

I have a whitelisted Facebook App that is out of sandbox mode and has been approved for the Ads API, but I am receiving the following error when trying to make requests to the Ads API.
{
"error": {
"message": "(#270) This Ads API request is not allowed for apps with only developer access",
"type": "OAuthException",
"code": 270
}
}
This occurs when using adgroupstats, adcampaignstats, and reportstats requests, etc. The adaccounts request does return my account information though. My dashboard does read "This app is public and available to all users", as I needed to get out of sandbox mode in order for my app to be whitelisted.
Is there another setting that I have missed in order to gain access to the Ads API calls that I need?
Answer:
This is most likely due to your dev/admin accounts of the app not being set as "Admins" in facebook's ad manager. Let me know if this solves this issue for you.
Old response:
I am running into the same issue. Can not run api calls against reportstats even though the user that the app/ad account belongs too was an admin, i change that user to a developer and its still happening.
I opened a bug report for this: https://developers.facebook.com/bugs/786289188058999

/accounts/test-users giving OAuthException

For some reason, I'm suddenly having trouble accessing my test users via the graph.
GETting this ...
https://graph.facebook.com/229607217115781/accounts/test-users&access_token=MYAPPACCESSTOKENHERE
Gives me:
{
"error": {
"message": "An access token is required to request this resource.",
"type": "OAuthException",
"code": 104
}
}
MYAPPACCESSTOKEN has been generated by calling
https://graph.facebook.com/oauth/access_token?client_id=MYAPPID&client_secret=SECRET&grant_type=client_credentials
and it returns the token just fine.
Looking at my git history, I'm pretty sure that this has worked before, making me suspect it's some breaking change I'm not aware of.
If your app is marked as a 'Desktop' app; you can't use the App Access Token for app administration via the API because it's assumed that you've distributed the app access token with the application binary and thus it can't be trusted as any of your users can decompile the app and get the app secret that way.
You can still use the Administration interface on developers.facebook.com for managing test users, or you can set your app back to 'Web' mode and the app secret will be usable for that call again