User doesn't have permission to access customer Error in Google Ads API

2,530 views
Skip to first unread message

Mark Guza

unread,
Jan 24, 2022, 6:22:27 AM1/24/22
to Google Ads API and AdWords API Forum
Hello! I try to change our code from Adwords API to Google Ads Api. I did all steps in https://github.com/googleads/google-ads-php ( Getting started). But when i run script GetCampaings.php with my customer id - i have an error.
Fault
-------
Status code: 7
Details: The caller does not have permission
Failure: {"errors":[{"errorCode":{"authorizationError":"USER_PERMISSION_DENIED"},"message":"User doesn't have permission to access customer. Note: If you're accessing a client customer, the manager's customer id must be set in the 'login-customer-id' header. See https:\/\/developers.google.com\/google-ads\/api\/docs\/concepts\/call-structure#cid"}]
In Adwords API all works fine. 
How to fix this problem? Maybe need to put a check mark somewhere? 

Mark Guza

unread,
Jan 24, 2022, 10:30:58 AM1/24/22
to Google Ads API and AdWords API Forum
Btw: i did all steps in 'Getting Started', install all extensions. And i found that when i connect developer token to GoogleAdsClientBuilder with: `->withDeveloperToken()`, and when i put some words, for example, ->withDeveloperToken('test') instead of my original developer token - i have the same issue, maybe it's the problem? Developer token is correctly 100%, because it use now for dowloading reports via Adwords API.

понедельник, 24 января 2022 г. в 14:22:27 UTC+3, Mark Guza:

Google Ads API Forum Advisor

unread,
Jan 24, 2022, 9:36:30 PM1/24/22
to m.g...@corp.101xp.com, adwor...@googlegroups.com
Hello Mark,

Thank you for reaching out.

As mentioned that you've encountered the error "USER_PERMISSION_DENIED", it usually has following root causes:
  • The link between the manager and client account was removed.
  • The OAuth credentials are for a user who does not have direct access to the Customer ID specified in the login-customer-id. 
With that, I would recommend that you generate the refresh token and the OAuth2 credential using an email address which currently has access to your Google Ads account you've set in the login-customer-id.

Best regards,
Google Logo
Jinky Mandaya
Google Ads API Team
 


ref:_00D1U1174p._5004Q2VOrxi:ref

Mark Guza

unread,
Jan 25, 2022, 1:37:41 AM1/25/22
to Google Ads API and AdWords API Forum
Hello! Thank you for your answer! But i can't get new refresh token and OAuth2, because now i have scripts that works on Adwords API ( for example to get reports and send 'postbacks'(data) in google.ads, and it all works fine. Maybe there is another problem? 

Google Ads API Forum Advisor

unread,
Jan 25, 2022, 11:17:36 AM1/25/22
to m.g...@corp.101xp.com, adwor...@googlegroups.com

Hello Mark,

Thanks for providing all the information. I understand that you’ve encountered the error ‘USER_PERMISSION_DENIED’, usually this error occurs when the authorized customer does not have access to the operating customer.
You may double check if your credentials are correct for the said user. With that error, I would recommend that you regenerate the refreshToken and the OAuth2 credential using an email address which currently has access to your Google Ads account. And for setting the login-customer-id header details you can find here

However, in the testing phase, the refresh token will expire in 7 days. Please refer to this OAuth guide: https://developers.google.com/identity/protocols/oauth2#expiration

If the issue persists, could you please provide us with the complete logs (request and response with request-id) via the Reply privately to the author option.

Best regards,

Google Logo
Jakeia Sabrina
Google Ads API Team
 

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