passport.initialize() middleware not in use for express 4.10 for custom callback
You should initialize passport before adding it to your route middleware: http://passportjs.org/guide/configure/
app.use(passport.initialize());app.use(passport.session());//authentication with session after connection to mydbcvar passport = require('./modules/auth')({mydbc:mydbc, io:io, app:app, passport:passport});
You are also redefining your passport var in server.js
which is unnecessary.