I am using Facebook ads api to read campaign from other account. I have created the application, got app_id and app_secret. In graph explorer, I am using other person’s access token and account id to get his campaigns. But facebook gives me following error:
{
"error": {
"message": "(#274) The ad account is not enabled for usage in Ads API. Please add it in developers.facebook.com/apps -> select your app -> settings -> advanced -> advertising accounts -> Ads API. Account 1817273581872129 not enabled for this application.",
"type": "OAuthException",
"code": 274,
"fbtrace_id": "GW38TMsIi1v"
}
}
I did followed error instructions but still the same problem.
here is the url i am using in graph explorer:
act_12345566654/campaigns
However, when I use facebook ads api in python:
I get the following error:
FacebookRequestError:
Message: Call was not successful
Method: GET
Path: https://graph.facebook.com/v2.8/act_1817273581872129/campaigns
Params: {'summary': 'true'}
Status: 400
Response:
{
"error": {
"message": "Invalid appsecret_proof provided in the API argument",
"code": 100,
"type": "GraphMethodException",
"fbtrace_id": "FRdlngO8f04"
}
}
Here is the code:
session = FacebookSession(self.app_id, self.app_secret, self.access_token)
ads_api = FacebookAdsApi(session)
adaccount = AdAccount(self.account_id, api=ads_api)
campaigns = adaccount.get_campaigns()
Where am I going wrong ? Kindly assist me
2
Answers
Most likely, the app secret that you have provided doesn’t belong to the app id or the access token that you are using doesn’t belong to the right app.
Check the following:
1) The app id
2) The app secret (should be of the specific app)
3) The access token (should be for the app specified above)
In case you still need it – in the explorer you must haven’t selected the app. This is on the top right corner. By default, it sets the app to Graph Api Explorer, click on the drop down menu, and choose your actual app.
Cheers!