Skip to content

Instantly share code, notes, and snippets.

@BenHall
Created February 29, 2012 14:48
Show Gist options
  • Save BenHall/1941301 to your computer and use it in GitHub Desktop.
Save BenHall/1941301 to your computer and use it in GitHub Desktop.
passport.js auth route
exports.ensureAuthenicated = function(req, res, next) {
if (req.isAuthenticated()) { return next(); }
res.redirect('/login')
}
var passport = require('./auth/passport');
app.get('/', passport.ensureAuthenicated, function(req, res){
res.redirect('/acquisition');
});
@DeviaVir
Copy link

Just a small typo:
ensureAuthenicated
which should be
ensureAuthenticated

Had me thrown off for a bit :)

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