refactoring passport.js