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

> Firebase throws auth/popup-closed-by-user when the sign-in popup closes before sign-in ends. Treat a real close as a cancel, then rule out the page setup.

Canonical: https://app369.com/fix/firebase-auth-popup-closed-by-user/
Last updated: 2026-11-09

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**](https://app369.com/fixed-price/flutter-firebase-bug-fix/) 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)**](https://github.com/firebase/firebase-js-sdk/blob/main/packages/auth/src/core/errors.ts) 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 November 9, 2026: [Firebase JS SDK source: auth errors](https://github.com/firebase/firebase-js-sdk/blob/main/packages/auth/src/core/errors.ts); [Firebase docs: Best practices for signInWithRedirect](https://firebase.google.com/docs/auth/web/redirect-best-practices).

## **Rather hand it over?**

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

- [from $450**App Fix Ticket**One reproducible bug in an existing mobile or web app, diagnosed and fixed.**See scope and start**](https://app369.com/fixed-price/flutter-firebase-bug-fix/)
- [from $450**AI-Built App Rescue**A Lovable, Bolt or Cursor app checked end to end in 3 days, then its worst problems fixed at a fixed price.****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.**See scope and start**](https://app369.com/fixed-price/ai-app-rescue/)

[**All 127 Fiverr reviews**](https://app369.com/reviews/)

Related: [**Firebase Google sign-in popup blocked**](https://app369.com/fix/firebase-google-sign-in-popup-blocked/) · [**Firebase auth/cancelled-popup-request**](https://app369.com/fix/firebase-auth-cancelled-popup-request/) · [**Firebase auth/unauthorized-domain**](https://app369.com/fix/firebase-auth-unauthorized-domain/) · [**Firebase user-token-expired**](https://app369.com/fix/firebase-auth-user-token-expired/)

Questions

## **More on this error**

<details>

<summary>**Should the app show an error? **+</summary>

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

</details>

<details>

<summary>**Is it the same as auth/popup-blocked? **+</summary>

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

</details>

<details>

<summary>**Can you fix it for me? **+</summary>

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.

</details>

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.

[**Describe your problem **→](https://app369.com/contact/) [**All fixes**](https://app369.com/fix/)