Any server configuration required to run OAuth 1.0a - getting OAUTH_TOKEN_HEADER_INVALID error on server where as running successfully on local setup and one server.

292 views
Skip to first unread message

Chirag

unread,
May 24, 2012, 8:52:20 AM5/24/12
to adwor...@googlegroups.com
Hello All,

Any special configuration required for Running OAuth 1.0a running succesfully?
I am trying to run one of my report download code, but it is giving error :

Error Message: <eye3-stackless title='AuthServer User Error OAUTH_TOKEN_HEADER_INVALID'/> AuthenticationError.OAUTH_TOKEN_HEADER_INVALID @ ; trigger:'<null>'; errorDetails:message=Invalid Header Service[ReportInfoService.get]

Please note : It is only has error from few server only. This same file is working on my localhost setup and also from two of my server.

Chirag

unread,
May 25, 2012, 7:15:08 AM5/25/12
to adwor...@googlegroups.com
Hello All,

Any update why I am not able to use Adhoc service from this centOS 5.5 server?
My code is working good on my local setup and also on ubuntu 10.10 server.

Thanks,
chirag

Danial Klimkin

unread,
May 28, 2012, 11:32:43 AM5/28/12
to adwor...@googlegroups.com
Hello Chirag,


Are you using any of our client libraries?


-Danial, AdWords API Team.

Chirag

unread,
May 29, 2012, 12:08:41 AM5/29/12
to adwor...@googlegroups.com
Hello Danial,

I am using PHP Client library.

Chirag

unread,
Jun 1, 2012, 2:32:08 AM6/1/12
to adwor...@googlegroups.com
Hello Danial,
Any update i am waiting for your reply otherwise i need to change server configuration from centOS to Ubuntu one.
Please note that i am using PHP client library.

Thanks,
chirag


On Monday, May 28, 2012 9:02:43 PM UTC+5:30, Danial Klimkin wrote:

Eric Koleda

unread,
Jun 1, 2012, 12:07:09 PM6/1/12
to adwor...@googlegroups.com
Hi Chirag,

It's strange that the error is only appearing on specific server environments. The next step in debugging this issue would be to take a look at the URL the SOAP request is being made to, since the PHP client library appends the OAuth parameters to the URL.  If you enable SOAP XML logging the URL is recorded in the logs.  Perhaps a visual inspection of the URL will show a difference between the environments.

One possible cause to investigate is whether the date and time is configured correctly on the server. When signing the OAuth parameters the current date/time is used, and if this is incorrect the AdWords API server may reject the request.

Best,
- Eric Koleda, AdWords API Team

Chirag

unread,
Jun 1, 2012, 12:32:15 PM6/1/12
to adwor...@googlegroups.com
Hello Eric,

Thanks for reply.
Yes i will look into date and time suggestion you mentioned.
But,for logging, I have $user->LogAll(); is set.
but i am not getting any log. I just got logs for reporting and it is attached.

Thanks,
chirag
log.txt

Eric Koleda

unread,
Jun 1, 2012, 12:49:58 PM6/1/12
to chirag....@gmail.com, adwor...@googlegroups.com
Hi Chirag,

My apologies, I forgot this was for report downloads, so you should only get a log with the report request. For report requests the OAuth parameters are passed in the Authorization header.  The value of the timestamp used seems to be wrong:

oauth_timestamp="1338338512"

This corresponds to Fri Jan 16 1970 06:45:38 GMT-0500 (EST), which is not correct.  What are the timestamps like for working requests?

Best,
- Eric

--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://adwordsapi.blogspot.com
http://groups.google.com/group/adwords-api
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
 
You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwor...@googlegroups.com
To unsubscribe from this group, send email to
adwords-api...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en

Chirag

unread,
Jun 1, 2012, 1:33:45 PM6/1/12
to adwor...@googlegroups.com, chirag....@gmail.com
Hello Eric,

I think timestamp is correct.

oauth_timestamp="1338338512" is refers to the Wed, 30 May 2012 00:41:52 GMT

What are the timestamps like for working requests?
I am not getting this. I am working with timezone 'Asia/Calcutta'.

Thanks,
Chirag

Eric Koleda

unread,
Jun 1, 2012, 2:26:15 PM6/1/12
to chirag....@gmail.com, adwor...@googlegroups.com
My apologies again, I was parsing it as milliseconds and not seconds. That does appear to be correct.

Regarding my other point, it would be helpful to compare the Authorization header from the server that is working with the one from the server that is not working. Can you post the sanitized version of both?

- Eric

Chirag

unread,
Jun 4, 2012, 7:23:32 AM6/4/12
to adwor...@googlegroups.com, chirag....@gmail.com
Hi Eric,

Sorry for late reply.
Please find both server's response.

Thanks,
chirag
working-server.txt
notworking-server.txt

Eric Koleda

unread,
Jun 4, 2012, 9:41:25 AM6/4/12
to chirag....@gmail.com, adwor...@googlegroups.com
Hi Chirag,

I didn't see any problems or noticeable differences with the broken request. Are these new OAuth tokens or are you using the same token on both servers? Can you double check that you are using the same consumer key and secret on both servers?

- Eric

Chirag

unread,
Jun 4, 2012, 12:28:40 PM6/4/12
to adwor...@googlegroups.com, chirag....@gmail.com
Hi Eric,

Are these new OAuth tokens or are you using the same token on both servers?
I am using same Oauth tokens for both servers.

Can you double check that you are using the same consumer key and secret on both servers?
Yes, I am using same consumer key and secret.

Thanks,
chirag

Eric Koleda

unread,
Jun 4, 2012, 1:57:57 PM6/4/12
to chirag....@gmail.com, adwor...@googlegroups.com
Hi Chirag,

Certainly a tricky problem. As a baseline, can you try running the command line example "UseOAuth.php" on both servers, to see if that works?

- Eric

Chirag

unread,
Jun 12, 2012, 3:51:49 AM6/12/12
to adwor...@googlegroups.com, chirag....@gmail.com
Hello Eric,
Sorry for late reply.

Finally i got access from server to run command line example "UseOAuth.php".
Yes on both server it works fine, but on server where adhoc report is not working there i got php warning for date.

PHP Warning:  date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Calcutta' for 'IST/5.0/no DST' instead in /var/www/html/src/Google/Api/Ads/Common/Util/Logger.php on line 234

Thanks,
chirag

Eric Koleda

unread,
Jun 12, 2012, 2:45:31 PM6/12/12
to chirag....@gmail.com, adwor...@googlegroups.com
Hi Chirag,

I would encourage you to set the timezone on that server in the php.ini file, to ensure the timestamps are accurate. Can you try replacing the CampaignService.get() call in the UseOAuth.php example with a report download request, and then run that on both servers?

Best,
- Eric

Chirag

unread,
Jul 7, 2012, 3:38:29 AM7/7/12
to adwor...@googlegroups.com, chirag....@gmail.com
Hi Eric,

Yes, i am successfully able to use Report Download Request from command line on both server.
When i set date_default_timezone_set('Asia/Calcutta'); That PHP warning also gone.

Please look at final result:

OAuth authorization successful.
Report with name 'Criteria performance report #4ff7dd422ea1a' was downloaded to '/var/www/html/cron/report_command_line.csv'.

Thanks,
Chirag

Eric Koleda

unread,
Jul 16, 2012, 10:37:52 AM7/16/12
to chirag....@gmail.com, adwor...@googlegroups.com
Great, glad you got it working!

- Eric


Chirag

unread,
Aug 26, 2012, 11:59:20 PM8/26/12
to adwor...@googlegroups.com, chirag....@gmail.com
Hello Eric,

I am again facing this issue "!!!2|||-1|||<eye3-stackless title='AuthServer User Error OAUTH_TOKEN_HEADER_INVALID'/> AuthenticationError.OAUTH_TOKEN_HEADER_INVALID @ "

Please find the attached report.

XML Report is as below..

[Aug 27 2012 04:40:05.000000 - ERROR] POST /api/adwords/reportdownload/v201109 HTTP/1.1
User-Agent: curl, gzip
Accept: */*
Accept-Encoding: gzip
Authorization: OAuth oauth_version="1.0a", oauth_nonce="dfd014ee2f50e3d6cd1f617844cc36ec", oauth_timestamp="1346038802", oauth_consumer_key="consumer_key", oauth_token="oauthtoken", oauth_signature_method="HMAC-SHA1", oauth_signature="Oauth signature"
developerToken: token
clientCustomerId: 3341002143
returnMoneyInMicros: false
Content-Length: 1317
Expect: 100-continue
Content-Type: multipart/form-data; boundary=----------------------------457169db54cc

Parameters:
__rdxml: <?xml version="1.0"?>
<reportDefinition>
  <selector>
    <fields>CampaignId</fields>
    <fields>Impressions</fields>
    <fields>Ctr</fields>
    <fields>AverageCpc</fields>
    <fields>AverageCpm</fields>
    <fields>Cost</fields>
    <fields>AveragePosition</fields>
    <fields>Conversions</fields>
    <fields>CostPerConversion</fields>
    <fields>ConversionRate</fields>
    <fields>ImpressionShare</fields>
    <fields>ExactMatchImpressionShare</fields>
    <fields>BudgetLostImpressionShare</fields>
    <fields>CampaignName</fields>
    <fields>Status</fields>
    <fields>Clicks</fields>
    <fields>AccountCurrencyCode</fields>
    <fields>QualityLostImpressionShare</fields>
    <fields>ViewThroughConversions</fields>
    <predicates>
      <field>Status</field>
      <operator>IN</operator>
      <values>ACTIVE</values>
      <values>PAUSED</values>
    </predicates>
  </selector>
  <reportName>weekly_campaign_report #1346038802</reportName>
  <reportType>CAMPAIGN_PERFORMANCE_REPORT</reportType>
  <dateRangeType>LAST_WEEK</dateRangeType>
  <downloadFormat>CSV</downloadFormat>
  <includeZeroImpressions>false</includeZeroImpressions>
</reportDefinition>

Response Code: 400
Error Message: <eye3-stackless title='AuthServer User Error OAUTH_TOKEN_HEADER_INVALID'/> AuthenticationError.OAUTH_TOKEN_HEADER_INVALID @ ; trigger:'<null>'; errorDetails:message=Invalid Header


- Eric

chirag
- Eric

- Eric

Hi Eric,
chirag
- Eric

Chirag
1346038802_879_weekly_campaign_report.csv

Chirag

unread,
Aug 28, 2012, 12:35:01 PM8/28/12
to adwor...@googlegroups.com, chirag....@gmail.com
Sorry Eric,
I contacted server side,again found same issue of date..
working fine now.
Reply all
Reply to author
Forward
0 new messages