Google API OAuth客户端:永远不允许Localhost提供客户端ID

编程入门 行业动态 更新时间:2024-10-16 18:40:12
本文介绍了Google API OAuth客户端:永远不允许Localhost提供客户端ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我已遵循此引导,并多次重新访问该步骤,但看不到我在做什么错(如果有的话).

I have followed this guide, and re-visited the step multiple times, but cannot see what I am doing wrong here, if anything.

我尝试添加 localhost 和 localhost:80 ,这是我的本地服务器运行的地方.

I have tried adding localhost and localhost:80, this is where my local server is running.

每当我尝试提示用户登录时,都会遇到错误:

Whenever I attempt to prompt the user for sign-in, I am met with the error:

[GSI_LOGGER]: The given origin is not allowed for the given client ID.

我尝试使用链接文档中描述的 g_id_onload div 块进行提示,但是我也尝试通过JS API触发提示,结果相同.这里没有很多步骤,但是我缺少明显的东西吗?是否出于某些奇怪的原因需要验证我的同意屏幕?我以为只有封顶了?

I have tried to prompt using the g_id_onload div block which is described in the linked document, but I have also tried triggering the prompt via the JS API, same result. There are not many steps here, but am I missing something obvious? Does my consent screen need to be verified for some strange reason? I thought there was just a cap until it is?

任何帮助将不胜感激!

更新:我在下面复制了实现(使用与以前使用的凭据相同的凭据),这似乎可行.但显然不再是实现One Tap的受支持方法.我认为这表明Google的一端出了问题吗?

UPDATE: I have replicated the implementation below (using the same credentials as I was using before), and that seemed to work. But obviously no longer a supported method for implementing One Tap. I think this point to something being wrong on Google's end?

github/zapier/google-yolo-inline

更新2:现在,我已尝试部署到暂存环境中,为此添加URL作为允许的来源.最终还是一样的错误.

UPDATE 2: I have now attempted to deploy to a staging environment, adding the URL for that as an allowed origin. Same error in the end.

推荐答案

发现了问题,我的网站实例的引荐来源网址策略设置为 no-referrer .将其设置为 no-referrer-when-downgrade (降级时不引用)后,One Tap提示会按预期显示.

Found the issue, my website instance had a referrer policy set to no-referrer. After setting it to no-referrer-when-downgrade, the One Tap prompt showed up as expected.

更多推荐

Google API OAuth客户端:永远不允许Localhost提供客户端ID

本文发布于:2023-11-07 15:26:23,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1566817.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:客户端   不允许   API   Google   OAuth

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!