Invalid Token Header

856 views
Skip to first unread message

htan...@gmail.com

unread,
Nov 20, 2014, 10:54:25 AM11/20/14
to adwor...@googlegroups.com
Hey,

I am getting an Invalid Token Header whenever i try to make an API Call.

I am using NodeJS for this and creating the soap requests manually using a client called node-soap

I am setting the header like so...

RequestHeader:{
developerToken:"XXXXXXXXXXXXXXXXXX",
userAgent:"MyAppName"
}

I am not setting the customerClientId because the purpose of this web app is for clients to export their data into an external database. Is there anything i am doing wrong?
This is the response.

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Header><ResponseHeader xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201409" xmlns="https://adwords.google.com/api/adwords/mcm/v201409"><ns2:requestId>0005084c430c10110ae0d8c4d8002aa6</ns2:requestId><ns2:serviceName>CustomerService</ns2:serviceName><ns2:methodName>get</ns2:methodName><ns2:operations>0</ns2:operations><ns2:responseTime>40</ns2:responseTime></ResponseHeader></soap:Header><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>[QuotaCheckError.INVALID_TOKEN_HEADER @ ]</faultstring><detail><ApiExceptionFault xmlns="https://adwords.google.com/api/adwords/mcm/v201409" xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201409"><ns2:message>[QuotaCheckError.INVALID_TOKEN_HEADER @ ]</ns2:message><ns2:ApplicationException.Type>ApiException</ns2:ApplicationException.Type><ns2:errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:QuotaCheckError"><ns2:fieldPath></ns2:fieldPath><ns2:trigger></ns2:trigger><ns2:errorString>QuotaCheckError.INVALID_TOKEN_HEADER</ns2:errorString><ns2:ApiError.Type>QuotaCheckError</ns2:ApiError.Type><ns2:reason>INVALID_TOKEN_HEADER</ns2:reason></ns2:errors></ApiExceptionFault></detail></soap:Fault></soap:Body></soap:Envelope>

Michael Cloonan (AdWords API Team)

unread,
Nov 20, 2014, 2:34:40 PM11/20/14
to adwor...@googlegroups.com
Hello,

Please take a look at our common errors page for this message and make sure that you double check that your developer token and namespacing are correct. If that doesn't help resolve the problem, please include your generated SOAP request in addition to the response so I can take a closer look. Make sure you strip out any sensitive data.

Regards,
Mike, AdWords API Team

htan...@gmail.com

unread,
Nov 20, 2014, 5:08:43 PM11/20/14
to adwor...@googlegroups.com
Hey Michael,

I am doing the Soap requests in node JS therefore using a node js client for this and not one of the ones provided.

var url='https://adwords.google.com/api/adwords/mcm/v201409/CustomerService?wsdl';
soap.createClient(url,function(err,client) {
client.addSoapHeader({RequestHeader: {
developerToken: "XXXXXXXXXXXXX",
userAgent: "API Project"
}},"","ns1","https://adwords.google.com/api/adwords/mcm/v201409");
client.setSecurity(new soap.BearerSecurity(accessToken));
client.get({},function(err,res){
console.log(err);
console.log(res);
})
});
the client is specified here: https://github.com/vpulim/node-soap
the last two parameters in the addSoapHeader function are Namespace Prefix and Namespace.

Would that be it?

Also i have had problems with my billing information, after the credentials are logged in and I submit it, I get an error message where it says the engineers have been notified....

Would that be the cause of the invalid_header_token error?

Thanks.

Michael Cloonan (AdWords API Team)

unread,
Nov 21, 2014, 9:47:16 AM11/21/14
to adwor...@googlegroups.com
Hello,

I understand that you are not using one of our client libraries. The common errors still apply to all SOAP requests, however, not just ones generated by our provided client libraries. That is why I want to see your SOAP request, so I can make sure that the XML is properly formatted and namespaced, and that the developer token is valid. Please respond directly to me by clicking "reply to author" including the unedited XML SOAP request so I can look into this.

One thing of note is that you are using .../mcm/v201409 in the header's namespace. This should be .../cm/v201409, even if you're making requests against services in mcm. That may help resolve your issue.

Regards,
Mike, AdWords API Team

htan...@gmail.com

unread,
Nov 25, 2014, 4:38:59 PM11/25/14
to adwor...@googlegroups.com
Hey Thanks Michael, when i use the namespace /cm/v201409 i get the following body error.

Reply all
Reply to author
Forward
0 new messages