Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Google button sign in doesn't work

Hello,

I'm trying add google sign-in button in a simple html page, but it doesn't work. I tested all possibilities available around internet topics. The first thing that I did was setting authorized domains to "http://localhost" but I'm getting the same error "The given origin is not allowed for the given client ID". Here my configs and html code. Someone can help me? Thanks 🙂

gauth3.pnggauth2.pnggauth1.png

1 1 2,016
1 REPLY 1

Hello @rafagodoy ,

Here's the steps provided by a 3rd party documentation:

Follow these steps to add Google Sign In button

  1. Create new project on Google console.
  2. Go to the Credentials page.
  3. Click Create credentials > OAuth client ID.
  4. Select the Web application application type.
  5. Add HTML code to your website and provide generated Client ID.
  6. Handle the callback URL as required.

Provided with the sample code when adding the sign in button on step number 5

<html>
<body>
<div id="g_id_onload"
data-client_id="YOUR_GOOGLE_CLIENT_ID"
data-login_uri="https://your.domain/your_login_endpoint"
data-auto_prompt="false">
</div>
<div class="g_id_signin"
data-type="standard"
data-size="large"
data-theme="outline"
data-text="sign_in_with"
data-shape="rectangular"
data-callback="OnSuccess"
data-logo_alignment="left">
</div>

</body>
</html>

 

Top Labels in this Space
Top Solution Authors