我正在将 Google One Tap api 添加到 React 应用程序。我正确地显示了一键登录模式。但是,我单击关闭了模式,现在收到以下响应,我看到该响应基于此 api 的 冷却期:
{
"g": "display",
"h": false,
"j": "suppressed_by_user"
}
由于我正在测试该应用程序,有没有办法覆盖这个冷却期?
看起来像以下:
componentDidMount() {
const handleCredentialResponse = response => {
console.log(response);
};
const client_id = "424242424-example26example44examplexyz.apps.googleusercontent.com";
const callback = handleCredentialResponse;
const auto_select = true;
google.accounts.id.initialize({ client_id, callback, auto_select });
google.accounts.id.prompt(notification => {
console.log(notification);
});
}
我想我已经解决了这个问题。我必须遵循以下指南才能完全清除
localhost:3000
的缓存:https://superuser.com/questions/278948/clear-cache-for-specific-domain-name-in-chrome
F12 >
Chrome Developer Tools
> Application
选项卡 > 左侧树中的 Clear storage
> 选择所有数据项 > 单击 Clear site data
当尝试迁移到适用于 Google One 的 FedCM API 时,点击接受的答案对我不起作用。
文档提到:
启用 FedCM 后,Chrome 用户可以通过单击地址栏中的锁定图标并单击“重置权限”按钮来重置冷却状态。
只需单击地址栏中 URL 旁边的图标,然后选择
Site Settings
然后选择
Reset Permissions
并重新加载。
在开发过程中避免“冷静”的另一种方法是使用隐身浏览器模式。
您可以重新启动无痕浏览器来清除所有缓存内容。