access token not getting refreshed after updating to V201502

92 views
Skip to first unread message

Seth

unread,
Apr 13, 2015, 4:48:47 PM4/13/15
to adwor...@googlegroups.com
Hey,

I just updated my app to V201502 a few days ago and now the access token no longer gets automatically refreshed. Any idea why that might be?

Thanks,
Seth



Danial Klimkin

unread,
Apr 14, 2015, 10:21:23 AM4/14/15
to adwor...@googlegroups.com
Hello Seth,


What client library are you using?


-Danial, AdWords API Team.

Seth

unread,
Apr 14, 2015, 10:25:34 AM4/14/15
to adwor...@googlegroups.com
google-adwords-api (0.14.2)

Seth

unread,
Apr 14, 2015, 10:26:26 AM4/14/15
to adwor...@googlegroups.com
Ruby

Danial Klimkin

unread,
Apr 14, 2015, 10:32:54 AM4/14/15
to adwor...@googlegroups.com
Please make sure you don't have access_token specified in the adwords_api.yml, just the refresh_token.


-Danial.

Seth

unread,
Apr 14, 2015, 10:34:27 AM4/14/15
to adwor...@googlegroups.com
Ok thanks!

Nadine Sundquist (AdWords API Team)

unread,
Apr 14, 2015, 10:35:18 AM4/14/15
to adwor...@googlegroups.com
Hi Seth,

I would recommend checking to make sure that your refresh token has not become invalid. Here are a few reasons why a refresh token may become invalid:
  • The refresh token expires after being unused for 6 months.
  • The refresh token limit per user per application has been reached. The current limit is listed in the OAuth 2.0 guide.
  • The user has revoked access.
Cheers,
Nadine, AdWords API Team

Seth

unread,
Apr 14, 2015, 10:40:10 AM4/14/15
to adwor...@googlegroups.com
now im getting this error AuthenticationError.OAUTH_TOKEN_HEADER_INVALID

Seth

unread,
Apr 14, 2015, 10:43:59 AM4/14/15
to adwor...@googlegroups.com
Im working with a brand new refresh token. My application runs until the token expires and then i get this error `AuthenticationError.OAUTH_TOKEN_INVALID`. I then need to get new tokens from oauth playground.

Danial Klimkin

unread,
Apr 14, 2015, 10:45:45 AM4/14/15
to adwor...@googlegroups.com
Hi Seth,


Did you make any changes to the configuration file between versions? There were no auth-affecting changes so the new version should work the same way with the same configuration file.

Make sure you still have 
  :oauth2_client_id
  :oauth2_client_secret
  :oauth2_token
    :refresh_token

defined.

Note, refresh token is a subkey of oauth2_token.


-Danial, AdWords API Team.

Seth

unread,
Apr 14, 2015, 10:48:32 AM4/14/15
to adwor...@googlegroups.com
Yeah, thats all the same. But until now i always had the `refresh_token` as well. When did that change?

Danial Klimkin

unread,
Apr 14, 2015, 10:53:25 AM4/14/15
to adwor...@googlegroups.com
Yes, you do need refresh_token on the config.

Please let me also now the ads-common and signet gem versions you are using.


-Danial.

Seth

unread,
Apr 14, 2015, 10:54:39 AM4/14/15
to adwor...@googlegroups.com
google-ads-common (0.9.8)
signet (0.6.0)

Seth

unread,
Apr 14, 2015, 10:57:45 AM4/14/15
to adwor...@googlegroups.com
Sorry i meant `access_token`, I always had both the `access_token` and `refresh_token`. I also just created a sample app with a fresh install of everything and its not working without the `access_token`

Danial Klimkin

unread,
Apr 14, 2015, 11:02:43 AM4/14/15
to adwor...@googlegroups.com
I'll try to create a fresh setup and reproduce.

In the meanwhile, can you describe the original issue in more detail? Did some of the request succeed but then stop?


-Danial.

Seth

unread,
Apr 14, 2015, 11:12:28 AM4/14/15
to adwor...@googlegroups.com

Yes, so when I go on OAuth 2.0 Playground and get new tokens my app runs (using both tokens in my yml file).  However, once the token expires it stops working and i'm getting the AuthenticationError.OAUTH_TOKEN_INVALID error.


Not sure if this makes a difference, but, I am keeping the `adwords_api.yml` in my apps root directory and passing as a param like this `AdwordsApi::Api.new("./adwords_api.yml")`.


Danial Klimkin

unread,
Apr 14, 2015, 11:31:40 AM4/14/15
to adwor...@googlegroups.com
Do you also have :issued_at: defined? What is its value?


-Danial.

Seth

unread,
Apr 14, 2015, 11:34:30 AM4/14/15
to adwor...@googlegroups.com
right now its blank

Danial Klimkin

unread,
Apr 14, 2015, 11:40:16 AM4/14/15
to adwor...@googlegroups.com
Try setting it to the timestamp of token generation, or to an old date. Eg.:

    :oauth2_token:
    :access_token: ****
    :refresh_token: ****
    :issued_at: 2014-05-13 14:29:18.110177979 +04:00


-Danial.

Seth

unread,
Apr 14, 2015, 11:47:16 AM4/14/15
to adwor...@googlegroups.com
Ok now im getting `rescue in refresh_token!': OAuth2 token refresh failed (AdsCommon::Errors::AuthError)

Danial Klimkin

unread,
Apr 14, 2015, 11:54:41 AM4/14/15
to adwor...@googlegroups.com
Hello Seth,


I suggest re-generating your refresh token. From the error below it looks like the refresh is triggered correctly but the token was not valid.


-Danial.

Seth

unread,
Apr 14, 2015, 12:01:24 PM4/14/15
to adwor...@googlegroups.com
Ok so i refreshed and im getting the same error. However, when I change `issued_at` back to blank the request works.

Danial Klimkin

unread,
Apr 14, 2015, 12:12:39 PM4/14/15
to adwor...@googlegroups.com
Interesting. Thanks for reporting. I'll check if something has changed with the new signet version.


-Danial.

Seth

unread,
Apr 14, 2015, 12:15:30 PM4/14/15
to adwor...@googlegroups.com
Ok thanks, let me know? Did you get your sample app working?

Danial Klimkin

unread,
Apr 14, 2015, 12:22:30 PM4/14/15
to adwor...@googlegroups.com
Sample app works for me (though I had to get a new refresh token as well).

I understand you could get requests to succeed, so the immediate problem was resolved for you?


-Danial.

Seth

unread,
Apr 14, 2015, 12:24:08 PM4/14/15
to adwor...@googlegroups.com
Not really, my app takes a few hours to run. I can only get the requests to work when i do a manual refresh, which i cant do while the app is running.

Seth

unread,
Apr 14, 2015, 1:39:13 PM4/14/15
to adwor...@googlegroups.com
Now that you got a new `refresh_token`, does your app refresh the `access_token` automatically or do you need to do that manually as well?

Danial Klimkin

unread,
Apr 15, 2015, 6:57:18 AM4/15/15
to adwor...@googlegroups.com
This is the expected behavior. Does it work for you now automatically?


-Danial.

Seth

unread,
Apr 15, 2015, 11:15:42 AM4/15/15
to adwor...@googlegroups.com
Yeah, I got it working.
Reply all
Reply to author
Forward
0 new messages