I have website where users can login with their google account. I am using javascript google api.login method to display google login dialog. By default, it triggers displaying new popup window
How to open google login dialog to be displayed in the same window where the user clicked on google Login button?
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet" type="text/css">
<script src="https://apis.google.com/js/client:platform.js?onload=render" async defer></script>
<script type="text/javascript">
function render() {
gapi.signin.render('customBtn',
{ 'callback': 'onSignInCallback',
'clientid': 'my-client-id',
'cookiepolicy': 'single_host_origin',
'requestvisibleactions': 'http://schemas.google.com/AddActivity',
'scope': 'https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email' }); } </script> <script type="text/javascript"> function onSignInCallback(authResult) { if (authResult['access_token']) { // The user is signed in var loc = '/account/SignInAsGoogleUser?accessToken=' + authResult['access_token']; window.location.href = loc; } else if (authResult['error']) { } }
</script>
<div class="align-center Google_Login_Btn"> <div id="gSignInWrapper">
<div id="customBtn" class="customGPlusSignIn">
<span class="icon"><i class="fa fa-google-plus"></i></span> <span class="buttonText">Log in With Google</span>
</div
> </div>
</div>