Skip to content

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

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!

@bustinjurkz

This comment has been minimized.

Copy link

commented Jun 17, 2019

Thank you so much for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.