Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

238
Visualizações
How to detect the "closed_by_user" event via the new "Google 3P Authorization JavaScript Library API"

I'm currently using the Google Sign-In JavaScript Platform Library for web. Via the grantOfflineAccess() function I request access to scopes from the users Google account with ux_mode: 'popup'.

auth2.grantOfflineAccess().then(
  response => {
    // response handling 
  },
  error => {
    // error handling
  },
)

Currently I'm able to detect if the popup is closed without authorization, because the error callback is called with this data:

{
  error: "popup_closed_by_user"
}

As Google is discontinuing this Sign-In API I'm migrating to the new Google 3P Authorization JavaScript Library

As part of the migration, I have modified the authorization flow to code like this:

google.accounts.oauth2.initCodeClient({
  client_id: '[...].apps.googleusercontent.com',
  fetch_basic_profile: false,
  ux_mode: 'popup',
  scope: '[...]',
  callback: response => {
    // handle google feedback
  },
}).requestCode()

As the docs state, the callback can have the parameters code, scope, state, error, error_description, error_uri and I expected it to be the equivalent of the previous callbacks, but it does not seem to be called for the popup_closed_by_user event.

Unfortunately, I was also not able to find an alternative callback.

Is someone aware wether the popup_closed_by_user event can be detected with the new library?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda