Skip to content

Instantly share code, notes, and snippets.

@badmonster0
Last active August 29, 2015 14:20
Show Gist options
  • Save badmonster0/f15f8c493f87ce41dd04 to your computer and use it in GitHub Desktop.
Save badmonster0/f15f8c493f87ce41dd04 to your computer and use it in GitHub Desktop.
where is the best place to extend cookie expire using passport?
// process the login form
app.post('/login', passport.authenticate('local-login', {
// successRedirect: '/profile',
// failureRedirect: '/',
// failureFlash: true
}), getLoginInfo)
//Instead of redirecting after passport, we want to run another middleware, then proceeds to redirect
function getLoginInfo(req, res, next){
req.session.cookie.maxAge = 14 * 24 * 3600
// next();
res.redirect('/profile')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment