Sunday 22 December 2019

passport-google-oauth20 not working in production?

It works fine in dev, but when I try to use it in production, once I select my google account it just keeps loading without redirecting until the connection times out. this is my googleStrategy code:EDIT: forgot to add. I also tried using an absolute path in the callback URL, but it's not working. passport.use( new GoogleStrategy( { clientID: keys.googleClientID, clientSecret: keys.googleClientSecret, callbackURL: "/auth/google/callback", proxy: true }, (accessToken, refreshToken, profile, done) => { User.findOne({ googleId: profile.id }).then(existingUser => { if (existingUser) { done(null, existingUser); } else { new User({ googleId: profile.id }) .save() .then(user => done(null, user)); } }); } ) );

Submitted December 22, 2019 at 09:51PM by Ivaanrl

No comments:

Post a Comment