QuotaCheckError.INVALID_TOKEN_HEADER. How to check what the issue is?

1,027 views
Skip to first unread message

Manu

unread,
Jul 12, 2016, 6:03:22 AM7/12/16
to AdWords API Forum

I'm trying to run the get_campaigns.py example code. I created the adwords client object using the correct, client_id, client_secret and refresh_token. When I run it however I get the traceback ending with

Server raised fault:

[QuotaCheckError.INVALID_TOKEN_HEADER @ ; trigger:'6Ji***developer-token****Yg']

When I scroll up the logs I see that HEADERS were logged and they don't mention any developerToken that should have been, as per this guide


URL: https://adwords.google.com/api/adwords/cm/v201605/CampaignService
HEADERS
: {'Soapaction': b'""', 'Content-Type': 'text/xml; charset=utf-8', 'Content-type': 'text/xml; charset=utf-8', 'Authorization': 'Bearer ya2***access_token***194f3g', 'SOAPAction': b'""'}
MESSAGE
: b'<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:tns="https://adwords.google.com/api/adwords/cm/v201605" xmlns:ns1="https://adwords.google.com/api/adwords/cm/v201605" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header><tns:RequestHeader><tns:clientCustomerId>659-360-1388</tns:clientCustomerId><tns:developerToken>6Ji***developer-token****Yg</tns:developerToken><tns:userAgent>MYM (AwApi-Python, googleads/4.2.0, Python/3.5.1)</tns:userAgent><tns:validateOnly>false</tns:validateOnly><tns:partialFailure>false</tns:partialFailure></tns:RequestHeader></SOAP-ENV:Header><ns0:Body><ns1:get><ns1:serviceSelector><ns1:fields>Id</ns1:fields><ns1:fields>Name</ns1:fields><ns1:fields>Status</ns1:fields><ns1:paging><ns1:startIndex>0</ns1:startIndex><ns1:numberResults>100</ns1:numberResults></ns1:paging></ns1:serviceSelector></ns1:get></ns0:Body></SOAP-ENV:Envelope>'


Also, could you please confirm this: the developer token was granted for in...@mydomain.com while the client_id and client_secret were created with reporting+...@mydomain.com which is a test manager account that I created for testing the API. Does this make a difference? Also, the developer_token is in test_account status now.

Can you please tell me what I am doing wrong? I can PM you my credentials and script to try it out at your end. I have been struggling to fix this issue for the last 5 days. If this Python lib is not well supported, please tell me what is the recommended platform so that I can I'll switch to it. Thanks a lot for you help!

Joyce Lava

unread,
Jul 12, 2016, 6:26:46 AM7/12/16
to AdWords API Forum
Hi Manu,

Could you please provide the actual login email that was used when requesting developer token and the actual login email of the test manager account? Please make sure to use Reply Privately to Author when sending these information.

Thanks and Regards,
Joyce, AdWords API Team

Joyce Lava

unread,
Jul 12, 2016, 7:14:37 AM7/12/16
to AdWords API Forum
Hi Manu,

Thanks for the information. INVALID_TOKEN_HEADER error occurs when the developer token is not set on the request or it contains a typo. The cause may also be an incorrect namespace of the header. Looking into your SOAP logs, it seems that you copied the developer token incorrectly. Please use the developer token which is found in the Account Settings -> AdWords API Center -> Developer token and modify the configuration file accordingly.

If the issue persists after double checking the developer token, please reply privately to author the SOAP request and response.

Manu

unread,
Jul 12, 2016, 7:31:18 AM7/12/16
to AdWords API Forum
Thank you so much Joyce! I'll do that and get back to you.
Reply all
Reply to author
Forward
0 new messages