Hide auto pop up for google login api javascript

Viewed 205

I used new Google login using new JavaScript API , I have problem that the when the page reloaded popup shown for login by google for login google accounts, I tried to find a way from the documentation but no result.

Is there a way to prevent the popup from shown?

enter image description here

1 Answers

Absolutely ! I had the same issue a while back. Here you can see the structure of the Javascript API. Remove the google.accounts.id.prompt(); line. Below is the complete initialization code for this.

window.onload = function () {
google.accounts.id.initialize({
  client_id: 'YOUR_GOOGLE_CLIENT_ID',
  callback: handleCredentialResponse
});
// remove this line
google.accounts.id.prompt();
};

For the sign in or sign up with google btn only the accounts.id.initialize is required.

Take a look at this documentation for further customization

Related