I am using passport-google-oauth20
for google authentication using passportjs. I am getting the accessToken. But the refreshToken I am getting is undefined.
here is the code I am writting-
const passport = require(‘passport’);
const GoogleStrategy = require(‘passport-google-oauth’).OAuth2Strategy;
const refresh = require(‘passport-oauth2-refresh’)
passport.serializeUser((user, done) => {
done(null, user);
})
passport.deserializeUser((id, done) => {
User.findById(id).then((user) => {
done(null, user);
})
})
var strategy = new GoogleStrategy({
callbackURL: “http://localhost:3000/auth/google/redirect”,
clientID: keys.google.clientID,
userProfileURL: ‘https://www.googleapis.com/oauth2/v3/userinfo’,
clientSecret: keys.google.clientSecret
}, async (accessToken, refreshToken, profile, done) => {
console.log(‘------------->’, accessToken, ‘\n------------->’,refreshToken);
});
passport.use(strategy);
refresh.use(strategy);