AuthenticationError.OAUTH_TOKEN_INVALID get_campaigns.py

43 views
Skip to first unread message

Jose La Rosa

unread,
Aug 25, 2020, 1:13:03 PM8/25/20
to AdWords API and Google Ads API Forum
Hi everyone i'm trying to get campaigns using the AdWords API

I write the developer token of my production manager account, also write the client_customer_id of my test manager account and test client account.
I tried using the OAuth id, secret and refresh token of my production and test account but i still getting the same error

(env) D:\Users\hoppe\Documents\GitHub\googleads-python-lib>d:/Users/hoppe/Documents/GitHub/googleads-python-lib/env/Scripts/python.exe d:/Users/hoppe/Documents/GitHub/googleads-python-lib/examples/adwords/v201809/basic_operations/get_campaigns.py
Your default encoding, cp1252, is not UTF-8. Please run this script with UTF-8 encoding to avoid errors.
Error summary: {'faultMessage': "[AuthenticationError.OAUTH_TOKEN_INVALID @ ; trigger:'<null>']", 'requestId': '0005adb6c3173e9f0ae9c302470dbb29', 'serviceName': 'CampaignService', 'methodName': 'get', 'operations': '1', 
'responseTime': '62'}
Traceback (most recent call last):
  File "d:\Users\hoppe\Documents\GitHub\googleads-python-lib\env\lib\site-packages\googleads\common.py", line 992, in MakeSoapRequest
    *packed_args, _soapheaders=soap_headers)['body']['rval']
  File "d:\Users\hoppe\Documents\GitHub\googleads-python-lib\env\lib\site-packages\zeep\proxy.py", line 45, in __call__
    kwargs,
  File "d:\Users\hoppe\Documents\GitHub\googleads-python-lib\env\lib\site-packages\zeep\wsdl\bindings\soap.py", line 130, in send
    return self.process_reply(client, operation_obj, response)
  File "d:\Users\hoppe\Documents\GitHub\googleads-python-lib\env\lib\site-packages\zeep\wsdl\bindings\soap.py", line 195, in process_reply
    return self.process_error(doc, operation)
  File "d:\Users\hoppe\Documents\GitHub\googleads-python-lib\env\lib\site-packages\zeep\wsdl\bindings\soap.py", line 299, in process_error
    detail=fault_node.find("detail"),
zeep.exceptions.Fault: [AuthenticationError.OAUTH_TOKEN_INVALID @ ; trigger:'<null>']

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "d:/Users/hoppe/Documents/GitHub/googleads-python-lib/examples/adwords/v201809/basic_operations/get_campaigns.py", line 68, in <module>
    main(adwords_client)
  File "d:/Users/hoppe/Documents/GitHub/googleads-python-lib/examples/adwords/v201809/basic_operations/get_campaigns.py", line 51, in main
    page = campaign_service.get(selector)
  File "d:\Users\hoppe\Documents\GitHub\googleads-python-lib\env\lib\site-packages\googleads\common.py", line 1004, in MakeSoapRequest
    e.detail, errors=error_list, message=e.message)
googleads.errors.GoogleAdsServerFault: [AuthenticationError.OAUTH_TOKEN_INVALID @ ; trigger:'<null>']

Google Ads API Forum Advisor Prod

unread,
Aug 25, 2020, 4:41:10 PM8/25/20
to jose4...@gmail.com, adwor...@googlegroups.com
Hi Jose,

The OAUTH_TOKEN_INVALID error indicates that your access token passed with the HTTP header was not correct. Can you confirm if the access token you are passing is still valid? It is worth noting that an access token expires after one hour. You may have to refresh your access token if it has expired. Additionally, can you provide your account customerClientId along with the email address of the user that authenticated the API call via the Reply privately to author option so that I can look further into this? If this is not available to you, you can email these details to us directly at googleadsa...@google.com

Regards,
Google Logo
Danica
Google Ads API Team
 


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