Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uncaught Failed to get parent origin from URL hash

Tags:

I am trying to setup google sign in for my web app. Currently, it is In the development state and running on http://localhost:8080/auth. I am using default Sign-In button provided by Google for user sign in. Whenever a new iFrame opens for user authentication, it hangs infinitely. When I checked a console, the following error message was shown there:

Uncaught Failed to get parent origin from URL hash!

Don't know what is the problem. I searched on various platforms but didn't find the solution anywhere, not even a thread discussing the issue. Similar questions are available on SO (1 and 2) but they are unanswered. This is how my simple HTML code looks like:

<html>
  <head>
    <script src="https://apis.google.com/js/platform.js" async defer></script>
    <meta name="google-signin-client_id" content="client-id-prefix.apps.googleusercontent.com">
  </head>
  <body>
    <div class="g-signin2" data-onsuccess="onSignIn"></div>
  </body>
</html>

Can somebody please help? It will help me and probably other 2 guys who had asked this question today itself.

like image 627
Abhilash Mandaliya Avatar asked Oct 09 '18 17:10

Abhilash Mandaliya


1 Answers

I found the mistake. I had not registered my domain under Credential -> My OAuth Client ID -> Authorized JavaScript origins. By adding, it started working.

Here are your credentials: https://console.developers.google.com/apis/credentials

like image 140
Abhilash Mandaliya Avatar answered Nov 29 '22 03:11

Abhilash Mandaliya