Last active
August 29, 2015 14:20
-
-
Save badmonster0/f15f8c493f87ce41dd04 to your computer and use it in GitHub Desktop.
where is the best place to extend cookie expire using passport?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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