Comments (12)
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
from facebook-php-business-sdk.
Also, please make sure your application has been whitelisted for access to the Facebook Ads API
from facebook-php-business-sdk.
Thanks for responding.
@phzhou, no I had not done that. But it seems it didn't help.
I did the following:
-
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/ -
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.
from facebook-php-business-sdk.
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.
from facebook-php-business-sdk.
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.
from facebook-php-business-sdk.
I tried emailing [email protected] 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?
from facebook-php-business-sdk.
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
from facebook-php-business-sdk.
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.
from facebook-php-business-sdk.
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
from facebook-php-business-sdk.
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:
-
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/ -
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 -
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
from facebook-php-business-sdk.
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.
from facebook-php-business-sdk.
Got it!
business.facebook.com > Settings > People > Assigned Ad Accounts
From here you can choose the role.
from facebook-php-business-sdk.
Related Issues (20)
- getDefaultRequestHeaders() is misspelled as getDefaultRequestHeaderds() HOT 1
- PHP 8.1 Deprecation HOT 4
- syntax error, unexpected '|', expecting ';' or '{' HOT 4
- Union types are only allowed since php8 HOT 2
- Exception: field 'id' is required Error HOT 2
- شخص ما أخترق حسابي الشخصي
- Normalizer.php strlen() must be of type string Problem
- Facebook Multi-Language Ads
- Syntax error in FB version v16.0.0 HOT 1
- The AdAccountFields enum does not currently implement the ACCOUNT_STATUS field. HOT 1
- Exception thrown without a stack frame in Unknown on line 0 HOT 1
- How to create a AAA advertisements above version 17
- Fix package installation instructions in README file
- Fff HOT 1
- error
- ad creative Url Tracking Params Update HOT 1
- OpenSSL SSL_connect: Connection reset by peer in connection to graph.facebook.com:443 Error
- Static singletons used everywhere HOT 3
- Incorrect PHPDoc types HOT 2
- Not able to access Business User Insights for multiple users using the Instagram API.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from facebook-php-business-sdk.