Refactor google login (use JavaScript API)