我的Google Auth卡在弹出式流量中。一键认证工作得很好,但是按钮<div id="g_id_signin"></div>就不行了。我点击它,弹出窗口就会打开,但是它仍然是空白的,没有进展。
<script>
function handleCredentialResponse(response) {
console.log("Encoded JWT ID token: " + response.credential);
...
}
window.onload = function () {
google.accounts.id.initialize({
client_id: "531144-------",
callback: handleCredentialResponse
});
google.accounts.id.renderButton(
document.getElementById("g_id_signin"),
{ theme: "outline", size: "large" } // customization attributes
);
google.accounts.id.prompt(); // also display the One Tap dialog
}
</script>
<div id="g_id_signin"></div>我有所有的域,本地主机添加了授权的重定向URI和重定向。但是,我仍然无法获得弹出来填充和完成身份验证流。任何帮助都是非常感谢的。
此时,我在FIREFOX中遇到的错误是:
Uncaught : window.opener为空li https://ssl.gstatic.com/_/gsi/_/js/k=gsi.gsi.en.i....O/am=wg/d=1/rs=AF0...w/m=credential_page_library:291 mi https://ssl.gstatic.com/_/gsi/_/js/k=gsi.gsi.en.i.....O/am=wg/d=1/rs=AF0...w/m=credential_page_library:29
在CHROME中:
(m=credential_page_library:291:151):
Uncaught :无法读取li TypeError中的null属性(读取'postMessage')
发布于 2022-06-09 22:56:15
您必须将SECURE_CROSS_ORIGIN_OPENER_POLICY设置为"same-origin-allow-popups" in settings.py。
参考资料:https://github.com/google/google-api-javascript-client/issues/796#issuecomment-1118136612
https://stackoverflow.com/questions/71371354
复制相似问题