refactored passport code into auth.js