You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
varpassport=require('passport');varGoogleStrategy=require('passport-google-oauth20').Strategy;varUser=require('@models/user');varconfig=require('@config');passport.use(newGoogleStrategy({clientID: config.googleClientId,clientSecret: config.googleClientSecret,callbackURL: config.googleCallbackUrl,scope: ['profile','email'],passReqToCallback: true,state: true,},function(req,accessToken,refreshToken,profile,done){console.log('profile: ',profile);try{varsearchQuery={name: profile.displayName};// store user info in mongoUser.findOne(searchQuery,function(err,user){if(err){console.log('[google] err: ',err);returndone(err);}elseif(user!==null){console.log('google user already there');returndone(null,user);}console.log("user not present, creating one...");user=newUser({name: profile.displayName,email: profile['_json']['email'],profileId: profile.id,google: {
accessToken,profileId: profile.id,email: profile['_json']['email']}});user.save(function(err){if(err){console.log('err occurred while saving google user: ',err);console.log(err);// handle errors!}else{console.log("saving user ...");}});});}catch(verifyErr){done(verifyErr);}}));module.exports=passport;
I've checked by logging the values in passport-oauth2 and passport-google-oauth20. Here's what I found:
The execution is going here with everything as expected (profile contains the expected data)
The control then goes to my passport google strategy file (mentioned above). Profile and access token being correct here as well.
But the issue is happening right after the above step, the execution is going right to the Strategy.userProfile function and the err block having the message of CONNRESET
This leads me to this error and the server exits. All the server code is exactly the same for github oauth but it works without any errors. This makes me think there's some issue with google's OAuth package?
Opening the issue here because the issue can also be in the request implementation and related to keep-alive timeout?
The text was updated successfully, but these errors were encountered:
This is my Google OAuth 2.0 passport option:
Here's my Google passport strategy:
I've checked by logging the values in passport-oauth2 and passport-google-oauth20. Here's what I found:
Opening the issue here because the issue can also be in the request implementation and related to keep-alive timeout?
The text was updated successfully, but these errors were encountered: