I have been trying to get local authentication work with passport on nodejs and as far as i can tell all of my code it is correct but i keep getting the same annoying error
I also had the same problem but when I put this line of code after the app.use(flash()) it worked:
app.use(flash())
app.use(passport.initialize()); app.use(passport.session()); app.use(flash()); require('./config/passport')(passport);