使用 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,但关闭弹出窗口时都没有被调用。
那么,有可能吗?我该怎么做 ?
谢谢