Error : 403 Request had insufficient authentication scopes

15,756 views
Skip to first unread message

Traktor Quick

unread,
Oct 26, 2021, 2:57:03 AM10/26/21
to AdWords API and Google Ads API Forum
Hello, I'm new to using Google Ads API, I'm trying to configure to be able to access reports via Google Ads API in Python.
- I use the same Gmail Account for Google Account Manager
- I have created a google cloud platform account with the same google ads account
- I have got the developer_token, client_id, client_secret and refresh_token which I have stored in my .Yaml file.
- then I tried to access the API with the aim of getting account information with the sample code provided here https://developers.google.com/google-ads/api/docs/samples/get-account-information
-after that I get an error response like the following:

grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
        status = StatusCode.PERMISSION_DENIED
        details = "Request had insufficient authentication scopes."
        debug_error_string = "{"created":"@1635229473.190000000","description":"Error received from peer ipv4:142.251.10.95:443","file":"src/core/lib/surface/call.cc"," file_line":1070,"grpc_message":"Request had insufficient authentication scopes.","grpc_status":7}"
>

The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "Test_API.py", line 64, in <module>
    main(googleads_client, args.customer_id)
  File "Test_API.py", line 32, in main
    customer = customer_service.get_customer(resource_name=resource_name)
  File "C:\Users\Juan\miniconda3\envs\quick_p1\lib\site-packages\google\ads\googleads\v8\services\services\customer_service\client.py", line 434, in get_customer
    response = rpc(
  File "C:\Users\Juan\miniconda3\envs\quick_p1\lib\site-packages\google\api_core\gapic_v1\method.py", line 142, in __call__
    return wrapped_func(*args, **kwargs)
  File "C:\Users\Juan\miniconda3\envs\quick_p1\lib\site-packages\google\api_core\grpc_helpers.py", line 68, in error_remapped_callable
    raise exceptions.from_grpc_error(exc) from exc
google.api_core.exceptions.PermissionDenied: 403 Request had insufficient authentication scopes.

What causes "403 Request had insufficient authentication scopes." ? how to i fixed?

Google Ads API Forum Advisor

unread,
Oct 26, 2021, 10:04:42 AM10/26/21
to trakto...@gmail.com, adwor...@googlegroups.com
Hello,

Thanks for reaching out. Can you please verify that the email used to create the OAuth credentials also has access in the target Ads accounts? If the user email does have access, can you please tell us how you retrieved your refresh token?

Thanks,
Matt
Google Ads API Team

Google Logo
Matt
Google Ads API Team
 


ref:_00D1U1174p._5004Q2QFE1V:ref

Traktor Quick

unread,
Oct 26, 2021, 9:04:23 PM10/26/21
to AdWords API and Google Ads API Forum
I use the same Email as my Google Ads account email to generate OAuth credentials

Google Ads API Forum Advisor

unread,
Oct 27, 2021, 9:58:46 AM10/27/21
to trakto...@gmail.com, adwor...@googlegroups.com
Hello,

If the email you are using is a managing user and does not have direct access to the client customer, you must specify the login-customer-id header. This is a common cause for this error. You can read more about the login-customer-id here.

Regards,
Reply all
Reply to author
Forward
0 new messages