Help! AuthenticationError.OAUTH_TOKEN_INVALID

215 views
Skip to first unread message

Alexey Chapurin

unread,
Oct 31, 2014, 3:58:38 AM10/31/14
to adwor...@googlegroups.com

Help to deal with a error AuthenticationError.OAUTH_TOKEN_INVALID
I do inquiry by an example https://developers.google.com/adwords/api/docs/guides/reporting

__rdxml="<reportDefinition>
      <id>1111111111</id>
        <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>CSV</downloadFormat>
      </reportDefinition>"

with headers:

Content-Length =  726

Content-Type =  " application/x-www-form-urlencoded"

Authorization =  "Bearer ya29.rgB3ZcocK-pwC7ksEClk9SU3W428m_Kw3BHwE7JJyN-sAKx84FUfO8gEh5"

developerToken =  "XХХХ-ХХХХХХХХХ_ХХХХХХ"

clientCustomerId = "111-111-1111"


token is correct that is visible from service:

https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=MY_TOKEN


{

 "issued_to": "111111111111-11111aaaaaaaaaaaaaaaaaaaaaaaa095.apps.googleusercontent.com",

 "audience": "111111111111-11111aaaaaaaaaaaaaaaaaaaaaaaa095.apps.googleusercontent.com",

 "user_id": "111111111111111111111",

 "scope": "https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile",

 "expires_in": 1192,

 "email": "m...@email.ua",

 "verified_email": true,

 "access_type": "offline"

}

 

Michael Cloonan (AdWords API Team)

unread,
Oct 31, 2014, 10:15:23 AM10/31/14
to adwor...@googlegroups.com
Hello,

For reference, the access token in the Authorization HTTP header allows API access to your account, and should be kept private. Luckily, they expire after only an hour, so exposing this one isn't a security threat, but you should be more careful in the future.

That is also likely the issue that is causing this error message. Since access tokens are only valid for an hour, you need to make sure that you get a new one before it expires if you want to continue making API calls.

Regards,
Mike, AdWords API Team

Alexey Chapurin

unread,
Nov 3, 2014, 2:44:02 AM11/3/14
to adwor...@googlegroups.com
Hello,

I use a new token and I receive this error message at any token, expire or new. In it all essence of a question. The token correct, it is confirmed by https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=MY_TOKEN .

пятница, 31 октября 2014 г., 16:15:23 UTC+2 пользователь Michael Cloonan (AdWords API Team) написал:

Anash P. Oommen (AdWords API Team)

unread,
Nov 3, 2014, 9:14:36 AM11/3/14
to adwor...@googlegroups.com
Hi Alexey,

From your mail, it looks like the token is valid only for 2 scopes 


To use AdWords API, you should also include https://www.googleapis.com/auth/adwords
as a scope. See https://developers.google.com/adwords/api/docs/guides/authentication for details.

Cheers,
Anash P. Oommen,
AdWords API Advisor.

Reply all
Reply to author
Forward
0 new messages