'Google Oauth popup cancellation callback

When using Google Identity Services (GSI) I can display a popup to ask users to connect with their Google account. This is pretty well documented and it works well with this code:

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();

However, I wish to do something if the user close the popup. I can't find anything in the documentation and in examples online. I tried intermediate_iframe_close_callback and native_callback, but neither are called when closing the popup.

So, is it possible ? How can I do it ?

Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source