I have a automated job to publish some data to facebook through API, it was working fine until recently it started throwing error
com.restfb.exception.FacebookOAuthException: Received Facebook error response of type OAuthException: Permissions error (code 200, subcode 1870034)
I googled subcode 1870034 but no help, if anyone have encountered this error previously ,please explain regarding this subcode.
Thanks for any help.
Doesn't seem it's related to TOS. For me error looked like
{"error":{"message":"Permissions error","type":"OAuthException","code":200,"error_subcode":1870047,"is_transient":false,"error_user_title":"Audience Size too Low","error_user_msg":"You cannot remove users from this audience because it will result in a low audience size.","fbtrace_id":"xxx"}}
Here you can find an official answer from FB team
https://developers.facebook.com/support/bugs/2093728693993530
Thanks for writing in. I can confirm that this is a valid error message. Custom Audiences must maintain a certain minimum size, though the specific number is not actually documented. I believe the required minimum is approximately 100 unique users. If you need to remove so many users that you're going under this limit, I'd recommend deleting the custom audience entirely.
Also why it's Permissions error...
I'm having the same issue for error subcode 1870034, which seems to come from a Custom Audience TOS issue, here is the full error message
You'll need to agree to the Custom Audience terms before you can
create or edit an audience of CUSTOM type.
You can try accept the Custom Audience TOS using this link https://www.facebook.com/ads/manage/customaudiences/tos/?act=AD_ACCOUNT_ID
(Though you'd probably need to own the ad account in this case)
Related
My team has had a FB marketing/business account for 2 years now, and we opened our sandbox account around that time. However, when I run my script to create an audience for the sandbox account, I receive this error:
status: 400,
response: {
error: {
message: '(#2654) Customer List Audiences Are Not Available: Ad accounts owned by businesses new to Facebook Products can create customer file Custom Audiences after several weeks of following our policies.',
type: 'OAuthException',
code: 2654,
error_subcode: 1870054,
fbtrace_id: '*****'
}
},
I've accepted the ToS as many answers have previously suggested. I've been able to populate the sandbox with other data, but creating an audience is giving me serious problems. If anyone has run into this issue or has any suggestions, I'd really appreciate the feedback.
Unlike targeting a custom audience, it seems impossible to create an ad targeting a saved audience using Facebook Ads API. Can someone confirm that is the case? What would be a workaround? This is the error I'm getting:
Error #100: Param targeting[custom_audiences][id] must be a valid custom audience id
There is a difference between a saved audience and a custom audience. A saved audience is an audience you manually create specifying age range, geographic region and interests. While a custom audience is a list of customers you gathered (uploaded or visitors or your site etc). You can create these audiences manually through the Ads Manager interface:
Using Graph API Explorer, one can retrieve saved audiences as follow:
act_1234567890/saved_audiences
Using Graph API Explorer, one can retrieve custom audiences as follow:
act_123456789/customaudiences
Note that 123456789 is not my real account number. I changed it for security reasons.
So, I can retrieve IDs for both custom audiences and saved audiences and creating an ad targeting a custom audience works fine, unlike targeting a saved audience which gives the above error message.
A cumbersome workaround could be to save the flexible_spec of each saved audience locally and use that spec when creating ads. The problem with that is that some targeting segments become invalid (Facebook decides to discontinue some segments at random times) which causes Facebook Ads API to hickup. Additionally, this means I constantly need to keep saved audiences in sync with my local copy. Unless of course I retrieve the targeting of a saved audience on the fly and re-use it, each time I create an ad resulting in yet another API request.
I figured it out myself. It seems impossible to directly target a saved audience unlike a custom audience, which is odd. What I did is retrieve the targeting from the saved audience first and reuse that targeting when creating the ad.
Here you see a screenshot of the official documentation showing only custom audiences and lookalike audiences can be targeted.
Retrieving targeting from saved audience (with Facebook PHP SDK):
$api = Api::instance();
use FacebookAds\Http\Request;
$response = $api->call(
"/987654321", 'GET',
array('fields'=>'targeting')
);
$audience = $response->getContent();
With 987654321 as the saved audience ID.
Then copy that targeting to the ad (with Facebook PHP SDK):
use FacebookAds\Object\Targeting;
use FacebookAds\Object\Fields\TargetingFields;
$targeting = new Targeting();
$targeting->setData($audience['targeting']);
The disadvantage of this technique is that the ad won't be updated when the saved audience is updated and that it requires an extra API call which slows down the creation of the ad.
I am getting the following error ("Error: HTTP status code: 400") now that I have updated to facebook SDK 3.1 as of yesterday, 10/9. But everything is completely functional as far as connecting with facebook, I just see this error message every time I start a facebook session on my app. I have seen a few people commenting on this, but I can't determine from them if this is going to be a real problem or not. Does anyone know definitively if this is going to cause a problem? And if so, how to fix it? Thanks!
The original issue was resolved by Facebook just after the 3.1 SDK was released.
But some are still having issues, if you have this issue you should check the login flow, and look at facebooks examples, after that if you are still having issues this could be a hint to a solution.
I got the 400 error when I do not have authorization to get to my information. The strange thing is that I get an accessToken and even a valid login (this is because I structured my code, with the help according to Scrumptious example and did a valid login when the Session state is open).
The FBSessionState is only opened for like a second and then it changes to closed with an 400 Error.
With iOS6 native login you get the permission alert when you ask for it, and then the phone remember that choice for 24 hours. But if the user logs in to the facebook home-page and then deletes permission for the application the phone will not recognize that the user has deleted the permissions for 24 hours, since it remembers the that the phone has already asked it and approved it (in the 24-hour window), regardless if you re-install the app or not.
I found this out after some hours of debugging, since I allowed the application from the Settings in iOS, but I could not post, and since I deleted the permission from the facebook privacy, and the alert would not show again there was nothing I could do but to manually give me permissions via a debug tool or wait 24 hours so I could accept the facebook-permission alert again.
I've tried do develop automatic code that would fetch data from ads campaigns under account. My plan is to have server that would query every day to get data from impressions/clicks/costs of ads and save it for later use.
I use https://developers.facebook.com/tools/explorer to get access_token for getting data (insights) from those campaign pages but when I log out to try offline_access it tells access_token is old, cause of password change or access_token getting outdated.
Isn't the whole point of offline_access to grant acccess when user is not logged in?
And besides that.. what's with most of my calls ending having reply as follows:
"(#294) Managing advertisements requires the extended permission ads_management, and a participating API key"
I've given access_token that has ads_management, but I have no idea what this Participating Api key even means. Do I need to add this to url call or something? Where do I get this Api Key?
Edit: I want to be able to get data from add campaign pages, so I'm not talking about Apps in page
You will want to read up on the deprecation of the offline_access here: https://developers.facebook.com/docs/offline-access-deprecation/
But most importantly follow the guide here on how to handle invalid access tokens:
https://developers.facebook.com/blog/post/500/
You app is to monitor the error messages coming back from the API and handle it gracefully.
I have the same issue and I found this bug can be reason of our problem. It's already accepted and assigned, but still not solved. I hope it's really bug and not a secure hole, that was closed :)
We are in the middle of upgrading to Auth 2.0 and have noticed a lot of errors in the Diagnostic page under Insights. It shows "gr:" (which I know means the graph api) and error code 2500 with almost 1 million errors. Unfortunately FB hasn't got any errors documented so I'm hoping someone at FB can clarify the error.
Apparently it is "An active access token must be used to query information about the current user." which means you're calling some API which requires access token without it.
If you do upgrading please note that some API calls now require access token like pageID/feed which previously it didn't.
hope this helps