Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

help with FacebookPermissionException #17

Closed
cornernote opened this issue Sep 26, 2014 · 12 comments
Closed

help with FacebookPermissionException #17

cornernote opened this issue Sep 26, 2014 · 12 comments

Comments

@cornernote
Copy link

Hello,

I am getting this error:

Facebook\FacebookPermissionException
(#294) Managing advertisements requires the extended permission ads_management and an application that is whitelisted to access the Ads API

I'm not sure what to try or who to contact. Any help would be greatly appreciated.

@phzhou
Copy link

phzhou commented Sep 26, 2014

Hi, did you include the ads_management permission when getting the the access token?
Please refer to the authentication guide here:
https://developers.facebook.com/docs/reference/ads-api/overview#access_token

@paulbain
Copy link
Contributor

paulbain commented Oct 8, 2014

Also, please make sure your application has been whitelisted for access to the Facebook Ads API

@cornernote
Copy link
Author

Thanks for responding.

@phzhou, no I had not done that. But it seems it didn't help.

I did the following:

  1. get the AUTHORIZATION_CODE from the URL after going here:
    https://www.facebook.com/dialog/oauth?client_id=YOUR_APP_ID&scope=ads_management&redirect_uri=https://www.my.com/

  2. get the $access_token from the response after going here:
    https://graph.facebook.com/oauth/access_token?
    client_id=YOUR_APP_ID&redirect_uri=YOUR_URL&
    client_secret=YOUR_APP_SECRET&code=AUTHORIZATION_CODE

My code looks like this:

        FacebookSession::setDefaultApplication($app_id, $app_secret);
        new Api(new FacebookSession($access_token));
        $set = new AdSet($ad_set_id);
        $set->{AdSetFields::NAME} = 'Test API Update';
        $set->update();

And I get back the exception mentioned above.

@paulbain How do I do that?

I read through this:
https://developers.facebook.com/docs/preferredmarketingdevelopers/ads-api-access

It indicated I needed to complete this application form:
https://www.facebook.com/help/contact/517221111658494

I did so, and was sent an approved email almost immediately.

The issue still persists.

@paulbain
Copy link
Contributor

paulbain commented Oct 9, 2014

It may be worth reaching out to the person from whom you received the email just to check it was whitelisted correctly.
Let me know your app id and I'll see if I can check also.

@cornernote
Copy link
Author

The email I thought was in reply to that contact was actually not. I have since received a reply to the whitelist request and they asked for the app id, and to ensure it was not in sandbox mode. It was in fact in sandbox mode.

Although it's not approved/working yet, I think this is the problem.

Thanks for the help.

@cornernote
Copy link
Author

I tried emailing adsapi@fb.com with a request to be whitelisted, however I still have not had a reply. I sent another email today and am hoping for a response.

Do you have any other suggestions regarding who I can contact to be whitelisted for ads api usage?

@cornernote cornernote reopened this Oct 29, 2014
@paulbain
Copy link
Contributor

we opened up access for everyone now in development mode, take a look at:
https://developers.facebook.com/docs/reference/ads-api/access/v2.1

@cornernote
Copy link
Author

Hi @paulbain,

I added my Ad Account IDs to the app settings (App > Settings > Advanced > Ads API).

I also noticed that when I make calls on the Account ID, a different Account ID is also added to the app's settings.

Still getting the same error:
(#294) Managing advertisements requires the extended permission ads_management and an application that is whitelisted to access the Ads API

I have worked with Google Ads, Bing Ads and several others. I'm struggling to understand why FB Ad API has this barrier to entry.

Is there anyone at FB that I should contact for help, or would I be better of working with you in this thread?

Thanks for all your help so far.

@paulbain paulbain reopened this Oct 29, 2014
@paulbain
Copy link
Contributor

in order to access advertising components of the Graph API, you need to request the ads_management permission from the user (which is probably you in this case). The key difference FB and other platforms is that we have a single unified platform which is permissioned.

Take a look at the getting started guide to see how to handle authentication:
https://developers.facebook.com/docs/reference/ads-api/overview#access_token

The best places to ask for help is either here for specific Ads API SDK issues, or StackOverflow for general technical questions and the marketing developer community on Facebook for more strategic/product questions:

http://stackoverflow.com/questions/tagged/facebook-ads-api
https://www.facebook.com/groups/pmdcommunity/

It would be great to hear your feedback onboarding with the SDK and how this can be improved also. That's probably best via messenger: fb.me/paulbain

@cornernote
Copy link
Author

Take a look at the getting started guide to see how to handle authentication:
https://developers.facebook.com/docs/reference/ads-api/overview#access_token

I did the following:

  1. get the AUTHORIZATION_CODE from the URL after going here:
    https://www.facebook.com/dialog/oauth?client_id=YOUR_APP_ID&scope=ads_management&redirect_uri=https://www.my.com/

  2. get the $access_token from the response after going here:
    https://graph.facebook.com/oauth/access_token?
    client_id=YOUR_APP_ID&redirect_uri=YOUR_URL&
    client_secret=YOUR_APP_SECRET&code=AUTHORIZATION_CODE

  3. I now have an $access_token, and I use it in the following code:

 FacebookSession::setDefaultApplication($app_id, $app_secret);
new Api(new FacebookSession($access_token));
$set = new AdSet($ad_set_id);
$set->{AdSetFields::NAME} = 'Test API Update';
$set->update();

This results in the error:

(#294) Managing advertisements requires the extended permission ads_management and an application that is whitelisted to access the Ads API

@cornernote
Copy link
Author

@paulbain,

As you suggested the issue was the Grey account. I added the account to the Business Manager as you suggested:
https://www.facebook.com/help/420039848100178

Seems to have got me past this error, however now I have a similar issue:
(#273) This Ads API call requires the user to be admin of the ad account. User XXX not admin on ad account YYY.

Do you know how I set my user to be the admin of the ad account?

Thanks for all your help.

@cornernote
Copy link
Author

Got it!

business.facebook.com > Settings > People > Assigned Ad Accounts

From here you can choose the role.

duliomatos added a commit that referenced this issue Apr 12, 2016
Summary:
Fixes #192 - #192
AuthorizationException is being thrown when the message is (#17) User request limit reached..
ThrottleException should be the correct type, which will signal API users that they are reaching call limits.

Test Plan: run any read call in a loop so we start getting throttled
duliomatos added a commit that referenced this issue Apr 12, 2016
Summary:
Fixes #192 - #192
AuthorizationException is being thrown when the message is (#17) User request limit reached..
ThrottleException should be the correct type, which will signal API users that they are reaching call limits.

Test Plan: run any read call in a loop so we start getting throttled
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants