How to get refresh token using passport google oAuth?

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”,
userProfileURL: ‘’,
}, async (accessToken, refreshToken, profile, done) => {
console.log(’------------->’, accessToken, ‘\n------------->’,refreshToken);


This is strictly specific to Google OAuth 2.0 and they have some specific requirements in terms of when refresh tokens are issued. You should check ( and just do a search by refresh token and read the relevant bits. For example, a specific parameter is required to issue a refresh token and after one is issued re-issuing another one also has its own considerations.