refresh_token not returned.

422 views
Skip to first unread message

emk

unread,
Dec 28, 2011, 5:10:39 AM12/28/11
to oauth...@googlegroups.com
I'm using the google-api-php-client for my web application. i've realised that refresh_token returned is always nil even when i set the access_type = offline
this is the response returned when exchanging for access_token:

HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Date: Wed, 28 Dec 2011 10:07:21 GMT
Content-Type: application/json
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
Transfer-Encoding: chunked

{
  "access_token" : "1.AH0000cuXMQmlcncZleg",
  "token_type" : "Bearer",
  "expires_in" : 3600,
  "id_token" : "token.eyJpZt9pIhIy-EpnNltq7_Q"
}

i tried using id_token as refresh_token, but it doesnt work at all. 
any help for this? 

Marius Scurtescu

unread,
Dec 28, 2011, 3:13:52 PM12/28/11
to oauth...@googlegroups.com
Hi,

Even with access_type=offline if there was a refresh token already
issued for the same user, scopes and client then auto-approval will
kick in and no new refresh token will be issued. Since one was issued
already there is no reason you should go through this flow again.

At this point you are either not using the proper flow or you lost the
original refresh token.

If you really want a new refresh token, even though you were already
given one, then also add approval_prompt=force to the auth request.
That will prevent auto-approval from happening.

Marius

Emilie Kueh

unread,
Dec 28, 2011, 9:35:47 PM12/28/11
to oauth...@googlegroups.com
Thanks alot for the help. :D i could get a refresh_token and make use of it now. :) 
--
Regards,
Edlyn Emilie Kueh
Sub-Committee Member

Temasek Polytechnic
Production Crew AY10/11

Contact: +65 81213214
Email: emili...@gmail.com
MSN: emili...@live.com.sg
Reply all
Reply to author
Forward
0 new messages