Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refresh token not returned even with accessType: 'offline', and approvalPrompt: 'force' #115

Open
thomasmurphycodes opened this issue May 13, 2016 · 8 comments

Comments

@thomasmurphycodes
Copy link

I am not receiving a refresh token, even with the parameters set as below. All other stackoverflow answers and closed issues seem to have had issues involving them not having syntax similar to below, so raising this as a new issue.

This code:
passport.authenticate('google', { scope: ["profile email https://www.googleapis.com/auth/calendar"], accessType: 'offline', approvalPrompt: 'force'}),

returns in the CB:
the access and refresh tokens are: ya29.CjLhArlZ3nRKqHdttUwrtYey4iS1P84cX59u0httnSACnk9NS1V-SRE0_SiQmZ9rpSbEuw undefined

@Nico-Nico-FR
Copy link

Nico-Nico-FR commented May 15, 2016

Response here : #23

@thomasmurphycodes
Copy link
Author

thomasmurphycodes commented May 16, 2016

@Nico-Nico-FR this doesn't seem to be the same issue we're talking about here. In my code above you can see that accessType and aprovalPrompt are set in passport.authenticate, just as the solution in the old linked question shows.

I've confirmed that adding the "session: false" to the passport.authenticate argument object does not cause a refresh token to return.

I think this is still a standing issue.

@cyan198
Copy link

cyan198 commented May 17, 2016

I'm also facing the same problem recently. Previously I'm able to get refresh token with the said parameters with or without session: false

@cyan198
Copy link

cyan198 commented May 17, 2016

BTW I figured out that this is a chrome issue because the confirmation page doesn't show in chrome. I've tested in Firefox, and I'm getting the refresh token.

related to: jaredhanson/passport-google-oauth2#4

Edit: I got excited too soon. It doesn't work in firefox as well.

@cyan198
Copy link

cyan198 commented May 17, 2016

Seems like approvalPrompt no longer works. Now I'm using prompt: 'consent' and it works.

@Nico-Nico-FR
Copy link

@cyan198 Thank you for tips, is it well working on my side !

@nutterbrand
Copy link

@cyan198 Thanks! This worked great.

@ethang404
Copy link

@cyan198 I'm way late to this chain but thank you so much! I think chrome just did an update and having the "approvalPrompt:force" suddenly doesn't work anymore. But the prompt:consent does.

I can't find any of this documented anywhere either :/. You're my hero

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants