score:0

i'm not positive but i think your problem might be in your configuration/configuration2 (i'm assuming these are different configurations for your passport?). configuration looks good if you just add some code to it from configuration 2.

const passport = require('passport');
const googlestrategy = require('passport-google-oauth').oauth2strategy;

passport.serializeuser(function (user, done) {
    done(null, user);
});

passport.deserializeuser(function (user, done) {
    done(null, user);
});

passport.use(
    new googlestrategy(
        {
            clientid:'secretclientid',
            clientsecret: 'enterclientsecret',
            callbackurl: 'http://localhost:3000/auth/google/callback',
        },
        function (accesstoken, refreshtoken, profile, done) {
            var userdata = {
                email: profile.emails[0].value,
                name: profile.displayname,
                token: accesstoken,
            };
            done(null, userdata);
        },
    ),
);

again, i'm not 100% on my answer but maybe try this and see if it helps. best of luck!


Related Query

More Query from same tag