Skip to content

Instantly share code, notes, and snippets.

@blehr
Last active July 10, 2017 18:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blehr/b79115066d975d8e3f7afcced8221d60 to your computer and use it in GitHub Desktop.
Save blehr/b79115066d975d8e3f7afcced8221d60 to your computer and use it in GitHub Desktop.
passport.use(new GoogleStrategy({
clientID: configAuth.googleAuth.clientID,
clientSecret: configAuth.googleAuth.clientSecret,
callbackURL: configAuth.googleAuth.callbackURL,
passReqToCallback: true
},
function(req, accessToken, refreshToken, params, profile, done) {
/*
params = {
access_token: 'Long_string',
token_type: 'Bearer',
expires_in: 3599, // seconds
id_token: 'Longer_string'
}
*/
// find expiry_date so it can be save in the database, along with access and refresh token
const expiry_date = moment().add(params.expires_in, "s").format("X");
...
}
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment