Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

217
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!