I am using express@3.0.0beta4 with a passport @ 0.1.12 and using local srategy for authentication.
Everything works fine and redirects to success and failure correctly
app.post('/login', passport.authenticate('local', { failureRedirect: '/' }), function(req, res) { console.log(req.isAuthenticated());
But if I add makeAuthenticated to the profile route
app.get('/users/:id', ensureAuthenticated, routes.user); function ensureAuthenticated(req, res, next) { console.log(req.isAuthenticated()); // false if (req.isAuthenticated()) { return next(); } res.redirect('/'); }
it redirects me back to '/' (which is the login page) instead of '/ users / id' (user profile) after login. The problem is req.isAuthenticated () always returns false, and there is no req.user variable in debug.
Is this a problem with Express 3 and passport interaction, or did I do something wrong?
source share