Problem refreshing access token for a web application

69 views
Skip to first unread message

Nelu Cambrea

unread,
Sep 15, 2014, 9:20:59 AM9/15/14
to adwor...@googlegroups.com
Hi all,

I have a problem trying to refresh the access token (OAuth2.0). I'm using the googleads-php-lib and everything is fine with the authorization process, request for tokens and I get access to the AdWords API.

The problem appears when I try to refresh the access token after about an hour. If I try to use:
$handler = $user->GetOAuth2Handler();
$new = $handler->RefreshAccessToken( $user->GetOAuth2Info() );

All I get is "An error has occured: { "error" : "invalid_grant" }" 

I have checked the $user->GetOAuth2Info() data and it is the correct data (client_id, client_secret, refresh_token, timestamp, expires_in). Have anyone any ideea why do I get that error instead of the refreshed access_token?

thanks,
Nelu

Ray Tsang (AdWords API Team)

unread,
Sep 15, 2014, 3:37:24 PM9/15/14
to adwor...@googlegroups.com
Nelu,

Typically invalid_grant means one of the information was not filled out correctly (e.g., putting developer token in as the client secret, etc), or that the refresh token is invalid, or that the original authorization URL may have missed critical parameters, such as using offline access.

Usually carefully following the Authentication guide would get you a working refresh token that can be re-used in most scenarios.

Thanks,

Ray
Reply all
Reply to author
Forward
0 new messages