My application needs to signup users using Google plus and then display the user's profile data. When the user edits their profile on Google plus and visits my application again, the app needs to show the updated data. Hence the application needs to store the access_token and refresh_token for future use. I want to manage all this using google's js api without any server side google-api-client.
The problem is that I am unable to retrieve the refresh_token using the js api. I have setup a jsfiddle here. The google plus related code is as follows:
$('#signInButton').click(function () {
attributes = {
'accesstype': 'offline',
'clientid': "260932337012-1gdbsh3p7oknkjmeaa7m9q7e6nhhgd9c.apps.googleusercontent.com",
'scope': 'email profile',
'cookiepolicy': 'single_host_origin',
'approvalprompt': 'force',
'callback': signInCallback
};
gapi.auth.signIn(attributes);
});
function signInCallback(authResult) {
alert(authResult.request_token);
}
The refresh_token is not returned inspite of setting accesstype to offline. What am I doing wrong here?
Thanks in advance.