Caller Does Not Have Permission

5,140 views
Skip to first unread message

Amber Xie

unread,
Jun 19, 2020, 5:43:05 PM6/19/20
to AdWords API and Google Ads API Forum
Hi,

I am following the Ads API Quickstart, and I'm on the First Call step. Although I'm able to compile, I'm given an error that the caller does not have permission. I'm not sure what the error is, because I've set ads.properties to be the correct refresh token, client id, developer token, and client secret. The account I'm accessing (in the GetCampaigns.java) is the account corresponding to the manager account I made in order to access a developer token. 

My app project's client id and client secret are connected to a different email; could that be why? Or am I missing other important tokens (like the access token, which I generated in the OAuth Playground, but never used anywhere)?

Thanks,

Google Ads API Forum Advisor Prod

unread,
Jun 22, 2020, 10:30:30 AM6/22/20
to adwor...@googlegroups.com
Hi Amber,

Yes, if the email you are authenticated as is not the email you used to create your OAuth2 credentials, you will receive a permission error. I suggest using the email connected to your OAuth2 credentials or creating new credentials with the email address you are currently using. Additionally, you will also need to ensure that the email address you are using is added as a user to your account. You can do this by going into the UI -> Tools & Settings -> Setup -> Account access and security. If you continue to experience issues, please provide your account's CID, complete detailed logs of the request and response, as well as the email address you are using to authenticate the API call so that I can take a closer look.  

Regards,
Danica, Google Ads API Team

ref:_00D1U1174p._5004Q2180Ly:ref

Amber Xie

unread,
Jun 22, 2020, 2:25:39 PM6/22/20
to AdWords API and Google Ads API Forum
Hi,

Unfortunately this did not fix it. I've inputted a managerId and a loginCustomerId corresponding to the manager account and a client account I've created directly underneath the manager. Running "mvn -X clean install exec:java -Dexec.mainClass="com.google.ads.googleads.examples.accountmanagement.GetAccountHierarchy"" givves me an error that User does not have permission to access customer, and that the manager's customer must be set in 'login-customer-id' header. See https://developers.google.com/google-ads/api/docs/concepts/call-structure#login-customer-id.

Where is the 'login-customer-id' header? Is it in the code or is it outside? 

I've tried callig just the managerId, but it gives me the error that loginCustomerId must be provided if managerId is provided.

Thanks!

Amber Xie

unread,
Jun 22, 2020, 2:33:12 PM6/22/20
to AdWords API and Google Ads API Forum
In addition, when I run the GetCampaigns.java from the library, and I input my clientID/secret/refresh token, I still don't have permission. I'm using the same email addresses, but I get the error PERMISSION_DENIED: The caller does not have permission. I've enabled the API and retrieved the necessary credentials, so I'm not sure what the error could be.

Amber Xie

unread,
Jun 22, 2020, 6:06:01 PM6/22/20
to AdWords API and Google Ads API Forum
Resolved. For further reference, you can add the login-customer-id header by looking at other example code in the client library. I was trying to access data from an account that was not finished setting up. 

On Monday, June 22, 2020 at 11:25:39 AM UTC-7 Amber Xie wrote:

Google Ads API Forum Advisor Prod

unread,
Jun 23, 2020, 10:13:39 AM6/23/20
to adwor...@googlegroups.com
Hi Amber,

Glad to hear your issue was resolved. If you have any additional questions, please don't hesitate to reach out.

Francesco Andrisani

unread,
Oct 21, 2020, 5:34:04 PM10/21/20
to AdWords API and Google Ads API Forum
Hi,
I've the same issue, but I don't understand how have you solved. What do you mean with " I was trying to access data from an account that was not finished setting up. "? And which other example hacve you seen that helped you to solve the issue?
Thanks and Regards

Google Ads API Forum Advisor Prod

unread,
Oct 22, 2020, 12:02:03 PM10/22/20
to mizc...@gmail.com, adwor...@googlegroups.com

Hi Francesco,

Thank you for reaching out. I see that you have posted your issues in another thread. We could continue our discussion in that thread to get your issue resolved. 

Thanks and regards,
Xiaoming, Google Ads API Team


Google Logo
Xiaoming
Google Ads API Team
 


ref:_00D1U1174p._5004Q2180Ly:ref
Reply all
Reply to author
Forward
0 new messages