Uncaught无法从URL哈希获取父源 [英] Uncaught Failed to get parent origin from URL hash

查看:96
本文介绍了Uncaught无法从URL哈希获取父源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为我的网络应用设置谷歌登录。目前,它处于开发状态并在 http:// localhost:8080 / auth 上运行。我使用Google提供的默认登录按钮进行用户登录。每当新的iFrame打开以进行用户身份验证时,它都会无限挂起。当我检查控制台时,显示以下错误消息:

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无法从URL哈希获取父源!

Uncaught Failed to get parent origin from URL hash!

不知道是什么问题。我在各种平台上搜索,但没有在任何地方找到解决方案,甚至没有讨论问题的线程。 SO上也提供了类似的问题( 1 2 )但他们没有得到答复。这就是我简单的HTML代码:

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>

有人可以帮忙吗?它会帮助我,也可能是其他2个今天就问过这个问题的人。

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

推荐答案

我发现了这个错误。我没有在Credential下注册我的域名 - >我的OAuth客户端ID - >授权的JavaScript源。通过添加,它开始工作。

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

以下是您的凭据: https://console.developers.google.com/apis/credentials

这篇关于Uncaught无法从URL哈希获取父源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆