Python client v9 throwing USER_PERMISSION_DENIED error

36 views
Skip to first unread message

Gabriel Viviani

unread,
Feb 8, 2022, 1:48:52 PM2/8/22
to Google Ads API and AdWords API Forum
Hello support team,

I'm migrating from old python client that will be deprecated soon to v9 one.
When loading config values from dict I receive following error:

Request with ID "HIDDEN (idk if I should show this)" failed with status "PERMISSION_DENIED" and includes the following errors:
        Error with 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".

And yes, I'm setting
https://developers.google.com/google-ads/api/docs/concepts/call-structure#cid on the config dict as well.

I'm receiving this error when trying to run a pytest execution that creates a budget.
Tricky thing is that I have a previous test that runs:

    assert ads_client.credentials.valid is True

and it passes.

I've also used other GoogleAdsClient setup forms, (loading envs from yaml and env).

Google Ads API Forum Advisor

unread,
Feb 9, 2022, 12:37:43 AM2/9/22
to gabriel...@nanos.ai, adwor...@googlegroups.com

Hi Gabriel,

Thank you for raising this concern to Google Ads API Team.

Since you have encountered the "PERMISSION_DENIED" error, kindly ensure that the user email used to create OAuth credentials also has the appropriate access for the Ads account that you are targeting. With this, please double check if your OAuth credentials are correct for the said user. Also, try following this suggestion "If you're accessing a client customer, the manager's customer id must be set in the 'login-customer-id' header" specified in the error message.

For the Python library, logging can be enabled by navigating to the Client libraries > Your Client library (select Python) > Logging documentation, which you can access from this link.

If you still encounter an error, you may provide us with the email address you used to generate the OAuth2 credentials, and complete request and response logs with the request-id generated on your end, so our team can better check.

You can provide it via Reply privately to the author option. If this option is not available, then send it instead on this email address googleadsa...@google.com.

Best regards,

Google Logo
Jinky Mandaya
Google Ads API Team
 


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