I\'ve looked at how error handling should work in node via this question Error handling principles for Node.js + Express.js applications?, but I\'m not sure what passport\'s
You need to add req.logIn(function (err) { }); and do the success redirect inside the callback function
req.logIn(function (err) { });