javascript - Google Oauth not getting refresh token -


i trying refresh token. read in google documents. now, using accesstype offline , approval_prompt: "force" not getting refresh token in response. not getting doing wrong.

i have following html code:

<input type="submit" class="btn btn-info" value="google" onclick="authorizewithgoogle()" /> 

javascript code:

 var cid = 'xxxxx';  var apik = 'xxxxx';  var scopes = 'https://www.google.com/m8/feeds';   function authorizewithgoogle() {      gapi.client.setapikey(apik);       gapi.auth.authorize({ client_id: cid, scope: scopes,  accesstype: "offline"   ,approval_prompt: "force"}, handleauthresult);  }   function handleauthresult(authresult) {      delete authresult['g-oauth-window'];  if (authresult && !authresult.error) {     console.log(json.stringify(authresult));        } } 

can please me.

you don't want requesting refresh tokens negates security of oauth. refresh tokens should ever requested/stored on server. might want take step , review understanding of oauth before continuing. trying implement oauth without understanding pita.

for browser client, should keep calling gapi.auth.authorize whenever need new access token (eg. approx every hour). after first call, can set immediate=true suppress ui.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -