Search code examples
javascriptgoogle-signingoogle-api-js-clientgoogle-identity

How to use Google Identity API and Sign in without a popup window?


I am new to StackOverflow and I am implementing a Google Sign-in for my application.I am following the guide from here https://developers.google.com/identity/sign-in/web/sign-in

But i do not not want a popup window to sign-in.Is it possible to click on the sign in button and be redirected sign in rather than popup the window and then after sign in redirect to home page?How should i implement this?Thank you.

<script src="https://apis.google.com/js/platform.js?onload=renderButton" async defer></script>

If I remove that line,my webpage wont redirect anymore.And i am getting this error after logging in : error here

var SCOPE = 'profile';
var params = {
    'client_id': client_id,
    'redirect_uri': redirect_uri,
    'scope': SCOPE,
    'state': 'try_sample_request',
    'include_granted_scopes': 'true',
    'response_type': 'token'
};

Solution

  • You might need to discard the Google JS library and do the redirection yourself. All the info you need is at https://developers.google.com/identity/protocols/OAuth2UserAgent