Answers for "passport google authentication node js"

1

passport google authentication node js

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
0

passport google authentication node js

$ npm install passport-google-oauth2
Posted by: Guest on April-16-2021

Code answers related to "passport google authentication node js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language