I\'m using Passport.js to login a user with username and password. I\'m essentially using the sample code from the Passport site. Here are the relevant parts (I think) of my c
You'll need to make sure that you register a middleware that populates req.session
before registering the passport middlewares.
For example the following uses express cookieSession middleware
app.configure(function() {
// some code ...
app.use(express.cookieParser());
app.use(express.bodyParser());
app.use(express.cookieSession()); // Express cookie session middleware
app.use(passport.initialize()); // passport initialize middleware
app.use(passport.session()); // passport session middleware
// more code ...
});