Instantly share code, notes, and snippets.

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();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment