Open ghost opened 7 years ago
Not sure if this helps, but if you look at line 95 the error actually appears to be a Google Plus API error: https://github.com/jaredhanson/passport-google-oauth2/blob/master/lib/strategy.js#L95
Sorry I don't know more than that.
Hi @theonlygusti
I don't know if your problem persists, I was coming across the same error, as pointed out in the comment above, it's a Google+ API error, it's probably not enabled on the console. You should try it, or any one else who comes across the same
Thanks
Can you try adding this option, when asking passport to use Google as a strategy ?
passport.use(new GoogleStrategy({ clientID: process.env.GOOGLE_OAUTH_CLIENT_ID, clientSecret: process.env.GOOGLE_OAUTH_CLIENT_SECRET, callbackURL: '/sign-in/after', userProfileURL: "https://www.googleapis.com/oauth2/v3/userinfo" }, function(accessToken, refreshToken, profile, cb) { User.findOrCreate({ googleId: profile.id }, function (err, user) { return cb(err, user); }); }));
Basically, you are asking google to use the userinfo api to authenticate the user rather than Google Plus's api.
@naveen1994rai
Thank you so much, you help me a lot with that suggestion!
<< userProfileURL: "https://www.googleapis.com/oauth2/v3/userinfo" >>
I am trying to use this strategy (passport-google-oauth20) to get OAuth 2.0 with Google working on my website.
However, after I am redirected back to my own site by Google my site crashes with this error message:
This error actually appears both on the web page and in the console.
Here's a summary of the code I'm attempting to get to work:
How can I stop this error and get the sign in by redirection to work? (My app already works with the JavaScript button sign-in.)