I get a error 400 when signing in with the google sign-in button on my webpage

4.5k Views Asked by At

I am trying to put a google+ sign-in button on my website, but I get a 400 error when I try to sign in with it. this is all I get.

400. That’s an error.

The requested URL was not found on this server. That’s all we know.the 

I have the following included in the <head>:

<script src="https://apis.google.com/js/platform.js" async defer></script>
<meta name="google-signin-client_id" content="620096179377-ula3qjt2s01qqhberlqq470n16kccnh5.apps.googleusercontent.com">

and the following where i wanted the button:

<div class="g-signin2" data-onsuccess="onSignIn"></div>
1

There are 1 best solutions below

2
Jarosław Gomułka On

This code should work for you:

<html>
<head>
  <title>Test Google Login</title>
  <script src="https://apis.google.com/js/platform.js" async defer></script>
  <meta name="google-signin-client_id" content="620096179377-ula3qjt2s01qqhberlqq470n16kccnh5.apps.googleusercontent.com">
  <script>
  function onSignIn(googleUser) {
    console.log(googleUser);
  }
  </script>
</head>
<body>
  <div class="g-signin2" 
   data-onsuccess="onSignIn"></div>
</body>
</html>

If the issue persists, could you attach details for request that causes 400? (url should be enough)