Answers for "google auth 2.0 passport"

1

google auth 2.0 passport

var GoogleStrategy = require( 'passport-google-oauth2' ).Strategy;

passport.use(new GoogleStrategy({
    clientID:     GOOGLE_CLIENT_ID,
    clientSecret: GOOGLE_CLIENT_SECRET,
    callbackURL: "http://yourdomain:3000/auth/google/callback",
    passReqToCallback   : true
  },
  function(request, accessToken, refreshToken, profile, done) {
    User.findOrCreate({ googleId: profile.id }, function (err, user) {
      return done(err, user);
    });
  }
));
Posted by: Guest on February-09-2021

Code answers related to "google auth 2.0 passport"

Code answers related to "Javascript"

Browse Popular Code Answers by Language