Refresh token

85 views
Skip to first unread message

Eldar Useinov

unread,
Jan 23, 2014, 10:51:22 AM1/23/14
to adwor...@googlegroups.com
Hi.

I have a question about OAuth2 and refresh token.

I recieved refresh token and ClienCustomerID for some user after he grant access to his account in my application (it was registered like web flow-application)
when i try to get data from his account in my php application it's ok. But i have another java application that try to get data from same account (using saved refresh token and ClienCustomerID) and i've got error "Unauthorized user".

What i did wrong?
Can i use Refresh token and ClienCustomerID for any applications (php, java)?

Josh Radcliff (AdWords API Team)

unread,
Jan 27, 2014, 1:02:54 PM1/27/14
to adwor...@googlegroups.com
Hi,

In your other Java application did you use the same clientId and clientSecret that you used to get the refresh token?  The refresh token is tied to those values, so if you try to use it for a different clientId and clientSecret you'll hit the "Unauthorized user" error.

Thanks,
Josh, AdWords API Team

Eldar Useinov

unread,
Jan 28, 2014, 3:53:24 AM1/28/14
to adwor...@googlegroups.com
Thank you for your answer.
Now i have different question. I recieve refreshToken for user account, than get data from his account (using java and php client libraries). Everything is ok. But when i try to use this refresh token and ClientCustomerId next day i face the "invalid_grant" error. 

When i try to authenticate again for this user and get new refresh token, it's working again. What's the reason of this error could be?

Thank you. 

понедельник, 27 января 2014 г., 20:02:54 UTC+2 пользователь Josh Radcliff (AdWords API Team) написал:

Josh Radcliff (AdWords API Team)

unread,
Jan 28, 2014, 3:09:28 PM1/28/14
to adwor...@googlegroups.com
Hi,

Are you using one of our client library examples to get the refresh token, or generating the OAuth2 requests manually?

Also, when you say "when i try to use this refresh token and ClientCustomerId next day" are you definitely using the refresh token and not the access token the next day?  The access token is only valid for a specific amount of time, after which you would need to use the refresh token to get a new access token.  Our client libraries handle this for you, which is why I'm curious if you are using one of the libraries.

Thanks,
Josh, AdWords API Team
Reply all
Reply to author
Forward
0 new messages