express javascript node.js passport-local passport.js

Express Passport.js Success redirect doesn’t load page, request keeps pending

I am trying to do a basic username/password authentication using passport.js and passport local.

While failureRedirect does exactly what it is supposed to do, (redirects to a specified page), successRedirect keeps pending with the request for its specified page, and after some time, it returns empty response.

As you can see in this picture, when it is requesting dashboard, it says that its size is 0B, but when I go on that dashboard without redirecting it says it has 1.6B.

I have looked all over Stackoverflow, and I couldn’t find an answer that would help me.

Could you please check my code and suggest something before I go berserk?

This is passport load code

//set expression
var expressSession = require('express-session');
secret: credentials.session.secret
//set passport
var passport = require('passport');
var localStrategy = require('./strategies/auth/local.js');
passport.use('local', localStrategy);
passport.serializeUser(function(user, done) {
passport.deserializeUser(function(id, done) {
User.findById(id, function(err, user) {
done(err, user);


module.exports = function(app) {
app.get('/', main.home);
app.get('/login', main.login);
app.get('/signup', main.signup);'/login', auth.loginLocal);'/signup', main.checkSignup);
app.get('/user/dashboard', user.dashboard);
app.get('/user/addmemory', user.addMemory);
app.get('/user/memory', user.memory);

login function

exports.loginLocal = passport.authenticate('local', {
successRedirect: '/user/dashboard',
failureRedirect: '/login'

local strategy

var localAuthStrategy = new LocalStrategy(function(username, password, done) {
username: username
}, function(err, user) {
if (err) {
return done(err);
if (!user) {
return done(null, false, {
message: 'Incorrect username'
if (!user.validPassword(password)) {
return done(null, false, {
message: 'Incorrect password'
return done(null, user);

dashboard function

exports.dashboard = function(req, res) {
res.render('user/dashboard', {
layout: 'user'