Instantly share code, notes, and snippets.

Embed
What would you like to do?
Used to restrict access to particular pages in combination with Passport.js
function authenticationMiddleware () {
return (req, res, next) => {
console.log(`req.session.passport.user: ${JSON.stringify(req.session.passport)}`);
if (req.isAuthenticated()) return next();
res.redirect('/login')
}
}
@rlavigne99

This comment has been minimized.

Copy link

rlavigne99 commented Jan 6, 2019

I would just like to say that I think your course was great. I am learning so much :) Thanks and keep it up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment