[GSI_LOGGER]:FedCM get() 因 IdentityCredentialError 拒绝:检索令牌时出错

问题描述 投票:0回答:1

我正在测试 FedCM,因为第三方 cookie 正在逐步淘汰。 我已经为我的网站成功实施了 Google OneTap 登录多年。您可以从实时网站进行验证。 我现在正在测试选择加入 FebCM。在我的浏览器中,启用了此设置:

Sites can show sign-in prompts from identity services.
对于第三方 cookie,选择此选项:
Block third-party cookies

我相应地添加了数据属性:

<div id="g_id_onload" data-client_id="***.apps.googleusercontent.com" 
data-login_uri="https://localhost:50001/account/external-login-google-one-tap?rurl=~%2F" 
data-use_fedcm_for_prompt="true">
</div>

页面加载后单击提示登录按钮时,出现错误:

错误:

When fetching the id assertion endpoint, a 403 HTTP response code was received.
localhost/:1 Provider's token is invalid.
client:48 [GSI_LOGGER]: FedCM get() rejects with IdentityCredentialError: Error retrieving a token.
google-signin googlesigninaccount fedcm
1个回答
0
投票

我遇到了完全相同的问题。碰巧的是 JavaScript 的起源不匹配。确保您的客户端在GCP 项目的凭据屏幕中正确配置了 javascript 源。如果您在 localhost 中进行测试,如果您使用的是 localhost:3000,请确保在 javascript 源中包含“http://localhost”和“http://localhost:3000”,否则它将无法工作。保存更改后,可能需要一些时间才能传播,但它应该可以工作。

© www.soinside.com 2019 - 2024. All rights reserved.