设置并使用自己的客户端ID运行后,我将完成登录过程,并在弹出窗口中选择所需的Google帐户。
选择此选项后,登录将失败,控制台中的错误为:
err = {error: "popup_closed_by_user"}
Run Code Online (Sandbox Code Playgroud)
有人可以帮我解决这个问题吗
使用 Google 身份服务 (GSI) 时,我可以显示一个弹出窗口,要求用户连接他们的 Google 帐户。这是有很好的文档记录的,并且它与以下代码配合得很好:
const client = window.google.accounts.oauth2.initCodeClient({
client_id: 'CLIENT_ID',
scope: 'SCOPE',
ux_mode: 'popup',
callback: async (response) => {
console.log('Response Google', response);
},
});
client.requestCode();
Run Code Online (Sandbox Code Playgroud)
但是,如果用户关闭弹出窗口,我希望执行一些操作。我在在线文档和示例中找不到任何内容。我尝试了intermediate_iframe_close_callback和native_callback,但关闭弹出窗口时都没有被调用。
那么,有可能吗?我该怎么做 ?
谢谢