Google API OAuth客户端:永远不允许Localhost提供客户端ID [英] Google API OAuth Client: Localhost never allowed for client ID
问题描述
我已遵循此引导,并多次重新访问该步骤,但看不到我在做什么错(如果有的话).
I have followed this guide, and re-visited the step multiple times, but cannot see what I am doing wrong here, if anything.
我尝试添加 http://localhost
和 http://localhost:80
,这是我的本地服务器运行的地方.
I have tried adding http://localhost
and http://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?
https://github.com/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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!