Refractor code for googleAuth.js