Skip to content

Firebase Auth errorFirebase Auth: auth/popup-closed-by-user

auth/popup-closed-by-user is the Firebase Auth error from signInWithPopup when the popup closes before sign-in finishes. Often the user closed it; sometimes the page lost its link to a popup that was still open.

Short answer

Catch the code and treat it as a cancel, without an error message. If users report it while the popup is still open, check the Cross-Origin-Opener-Policy header on the page, which developers commonly report as a cause, and test in the browsers your users have.

Rather not fix it yourself? App Fix Ticket starts with a fixed-price diagnosis, then a fixed price for the fix before any fix work.

Why the popup closes, and the fix

  1. 01

    The user closed the popup

    “The popup has been closed by the user before finalizing the operation.” Firebase, Firebase JS SDK auth errors (POPUP_CLOSED_BY_USER)

    Closing the Google or Apple window is a normal cancel. Catch it and leave the sign-in buttons as they were.

    import { getAuth, signInWithPopup, GoogleAuthProvider } from 'firebase/auth';
    
    try {
      await signInWithPopup(getAuth(), new GoogleAuthProvider());
    } catch (error) {
      if (error.code === 'auth/popup-closed-by-user') return; // user cancelled
      showError(error);
    }
  2. 02

    A COOP header on the page (commonly reported)

    Developers commonly report this error with Cross-Origin-Opener-Policy set to same-origin, which keeps the page from tracking the popup. If your hosting sets that header, try same-origin-allow-popups on pages that sign in and test again.

  3. 03

    The app runs in an in-app browser

    In practice, browsers inside other apps often handle popups badly. signInWithRedirect is an alternative there, but it needs the setup in Firebase’s redirect best practices to work in browsers that block third-party storage.

  4. 04

    The popup was slow to finish

    Also check: a sign-in popup that loads slowly invites users to close it. Test the flow on a slow connection and keep the work before signInWithPopup short.

Checked against the vendor’s docs on : Firebase JS SDK source: auth errors; Firebase docs: Best practices for signInWithRedirect.

Rather hand it over?

Fixed scope, fixed price, paid upfront. The work happens in writing; no call needed.

“Very responsive, attentive to fixing bugs, and completed the project as needed! Thank you!”
A buyer in the United States, July 2022. Shopify on Fiverr
All 127 Fiverr reviews

Related: Firebase Google sign-in popup blocked · Firebase auth/cancelled-popup-request · Firebase auth/unauthorized-domain · Firebase user-token-expired

Questions

More on this error

Should the app show an error?

Usually no. When the user closed the popup, a quiet return to the sign-in screen is enough.

Is it the same as auth/popup-blocked?

No. auth/popup-blocked means the browser never opened the popup; auth/popup-closed-by-user means it opened and then closed early.

Can you fix it for me?

If one bug is the whole problem, the App Fix Ticket covers it: a written diagnosis first, then the fix. If the app has more going on, the Launch Check is a written check of the whole app. Each issue found is rated critical, high, medium or low, with where it is and how it was confirmed. No issues worth fixing, no charge. If the Launch Check finds nothing rated medium or higher, Simon refunds the full $450. You keep the report either way. This applies to the first 10 Launch Checks bought after October 30, 2026.

A different error?

Describe it and get a written quote

Send the error and what you were doing. You get a written scope, a fixed price and a timeline; Simon replies by email, usually within one business day.