Comments (4)
Google does only return an refreshToken
if offline access was requested [1]. You can tell passport to request offline access by adding accessType: 'offline'
to the options passed to authenticate.
e.g. app.get('/auth/google', passport.authenticate('google', { accessType: 'offline' }));
Please also not that Google only gives you a refreshToken
the first time a user approves your application.
To get a refresh token again you need to force Google to display the consent screen again. This can be done by passing approval_prompt: 'force'
to the authenticate options.
I hope this helps.
[1] https://developers.google.com/accounts/docs/OAuth2WebServer#offline
from passport-google-oauth.
I do have accessType: 'offline'
setup.
Also, the approval_prompt: 'force'
is not working.
I cloned this repo, put up my credentials and ran the oauth2
code under examples/
with still no luck.
Is it possible that it has to do with my app registered on google's console? Are there permissions I should do there or something?
from passport-google-oauth.
Could you try to remove the authorization for the app in your google account.
This way google will ask you for authorization again. In that case I received a refreshToken.
You can revoke the authorization here: https://security.google.com/settings/security/permissions
from passport-google-oauth.
Ah... so @jaredhanson has a different naming convention, it should be approvalPrompt
with no underscore.
@jaredhanson this is kind-of misleading. Can we have all optiosn named like in the original google documentation
Now i'm getting a refresh token! Thanks :)
from passport-google-oauth.
Related Issues (20)
- OAuth2Strategy requires a verify callback how to fix it? HOT 12
- InternalOAuthError "message": "failed to obtained request token" HOT 2
- Support include_granted_scopes [feature request] HOT 1
- how to get the idtoken in the callback for googleStrategy
- Getting user birthday HOT 3
- passReqToCallback slightly inconsistent with Express, doc update? HOT 1
- Passport session not store on google login HOT 1
- Missing required parameter: scope" in app serverless HOT 2
- Changelog for version 2? HOT 1
- Can not get user domain with version 2.0 HOT 4
- howto solve this?
- Disconnecting app from Google account
- PWA and auth link
- id_token
- Restrict To Server Side validation (Needed Feature to verify idToken )
- Error 400: invalid_request Missing required parameter: redirect_uri HOT 1
- InternalOAuthError: Failed to obtain access token HOT 3
- Error 403: disallowed_useragent for a node.js web-site
- Race Condition , accepting new requests before the session of first user finishes HOT 1
- Failed to serialize user into session
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from passport-google-oauth.