AdWords
2.4K members online now
2.4K members online now
Use AdWords conversion tracking and reporting to measure your results. Have a question about Google Analytics? Post it here, on the Google Analytics Community!
Guide Me
star_border
Reply

AuthenticationError.USER_ID_INVALID in code not OAuth2.0 Playground

[ Edited ]
Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Context: Windows 7, IE10, JScript, Peloton, Msxml2.ServerXMLHTTP.6.0

When I execute the following in OAuth2.0 Playground it works perfectly

 

    POST /api/adwords/reportdownload/v201402 HTTP/1.1
    Host: adwords.google.com
    Clientcustomerid: blah-blah
    Developertoken: blah_blah
    Content-type: application/x-www-form-urlencoded
    Content-length: 545
    Authorization: Bearer ya29.1.blahblahblah
    __rdxml=<reportDefinition xmlns="https://adwords.google.com/api/adwords/cm/v201402"><selector><fields>CampaignId</fields><fields>Id</... Adgroup Performance Report</reportName><reportType>ADGROUP_PERFORMANCE_REPORT</reportType><dateRangeType>LAST_7_DAYS</dateRangeType><downloadFormat>TSV</downloadFormat></reportDefinition>

 

However, when I submit the same values programmatically, I get `AuthenticationError.USER_ID_INVALID`

<@ LETVARo1lCAP>AdHocReport1|
<reportDefinition xmlns="https://adwords.google.com/api/adwords/cm/v201402">
<selector>
<fields>CampaignId</fields>
<fields>Id</fields>
<fields>Impressions</fields>
<fields>Clicks</fields>
<fields>Cost</fields>
<predicates>
<field>Status</field>
<operator>IN</operator>
<values>ENABLED</values>
<values>PAUSED</values>
</predicates>
</selector>
<reportName>Custom Adgroup Performance Report</reportName>
<reportType>ADGROUP_PERFORMANCE_REPORT</reportType>
<dateRangeType>LAST_7_DAYS</dateRangeType>
<downloadFormat>TSV</downloadFormat>
</reportDefinition></@>

....

<@ DEFUDOLITLIT>:Hp|__Transformer|
<@ DEFKEYLIT>__WSHLanguage|JScript</@>
<@ LETSCPPAR>url|1</@>
<@ LETSCPPAR>head|2</@>
<@ LETSCPPAR>body|3</@>
<@ sayLETSCPCAP>code|
	var SXH_OPTION_ESCAPE_PERCENT_IN_URL = 1;
	var SXH_OPTION_IGNORE_SERVER_SSL_CERT_ERROR_FLAGS = 2;
	var SXH_OPTION_SELECT_CLIENT_SSL_CERT = 3;
	var SXH_OPTION_URL = -1;
	var SXH_OPTION_URL_CODEPAGE = 0;

	var SXH_SERVER_CERT_IGNORE_UNKNOWN_CA = 256;
	var SXH_SERVER_CERT_IGNORE_WRONG_USAGE = 512;
	var SXH_SERVER_CERT_IGNORE_CERT_CN_INVALID = 4096;
	var SXH_SERVER_CERT_IGNORE_CERT_DATE_INVALID = 8192;
	var SXH_SERVER_CERT_IGNORE_ALL_SERVER_ERRORS = 13056;

	function HTTPPOST4(url, rHeaders, body) {
	  var oHTTP = new ActiveXObject("Msxml2.ServerXMLHTTP.6.0");
	  oHTTP.setOption(SXH_OPTION_IGNORE_SERVER_SSL_CERT_ERROR_FLAGS, oHTTP.getOption(SXH_OPTION_IGNORE_SERVER_SSL_CERT_ERROR_FLAGS) - SXH_SERVER_CERT_IGNORE_ALL_SERVER_ERRORS);
	  oHTTP.setTimeouts(1000000, 1000000, 1000000, 1000000);
	  oHTTP.open("POST", url, false);

	  for (var r in rHeaders) {
		oHTTP.setRequestHeader(r, rHeaders[r]);
	  }
	  
	  oHTTP.send(body);
	  var res = oHTTP.responseText;
	  return res;
	}
	var head = <@ sayscp>head</@>;
	var body = '<@ SAYSCP>body</@>';
	HTTPPOST4('<@ SAYSCP>url</@>', head, body);
</@>
<@ LETRESCLCSCP>...|code</@>
<@ DEFKEYLIT>__WSHLanguage|VBScript</@>
</@>

 
The language wrapped around the JScript is called Peloton, and is used in-house. The header values are passed in as a JSON object and the body as a string.

The result XML I get from this says

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<reportDownloadError><ApiError><type>AuthenticationError.USER_ID_INVALID</type><trigger>&lt;null&gt;</trigger><fieldPath></fieldPath></ApiError></reportDownloadError>

If the 'trigger' is to be believed, where is the '&lt;null&gt;'?

1 Expert replyverified_user

Re: AuthenticationError.USER_ID_INVALID in code not OAuth2.0 Playgroun

Google Employee
# 2
Google Employee

Hi Axtens,

 

Thank you for posting on our Community forum. Can you explain what exactly your trying to do with the OAuth 2.0 Playground and Google AdWords? Since this looks like an API issue, you may also want to post your question on the Google Developer's website here: https://developers.google.com/