What is /__/auth/handler in Firebase Auth?
https://<authDomain>/__/auth/handler is the helper page Firebase Auth opens during popup and redirect sign-in: it sends the user to Google (or another provider), receives the provider's response, and hands the result back to your app. Because the provider sends its response to this URL, it must be listed as an authorized redirect URI on your OAuth client, exactly as it appears with your authDomain.
What the handler does in the sign-in flow
- Your app calls
signInWithPopup()orsignInWithRedirect(). - The Firebase JS SDK builds the URL
https://${authDomain}/__/auth/handlerand opens it in the popup or the current tab. - The handler redirects to the provider. In Firebase's words, "authDomain hosts the sign-in helper code that redirects to the Identity Provider, which, on success, redirects back to the app domain."
- The provider sends the user back to the handler, which passes the result to your app.
The SDK also loads a sibling page, https://${authDomain}/__/auth/iframe, in the background. That is why any setup that moves authDomain must serve the whole /__/auth/* path, not just the handler. If authDomain isn't set, the SDK throws auth/auth-domain-config-required before it gets this far. For the setting itself, see what Firebase authDomain is.
What the handler URL contains
A real handler URL carries query parameters that the SDK adds. From the SDK source, they can include:
| Parameter | What it is |
|---|---|
apiKey |
Your Firebase web API key (a public identifier) |
appName |
The name of the Firebase app instance |
authType |
The operation, such as popup or redirect sign-in |
redirectUrl |
The page to return to after a redirect |
providerId |
The provider, for example google.com |
scopes, customParameters |
Extra scopes and provider parameters you set |
v |
The SDK version |
eventId, tid |
An event ID, and the tenant ID if you use multi-tenancy |
An App Check token, if you use App Check, is passed in the URL fragment (#fac=…). Seeing your apiKey in this URL is expected: Firebase says API keys for its services "only identify your Firebase project and app to those services."
What it serves
/__/auth/* is part of Firebase Hosting's reserved namespace. Firebase says Authentication "uses the reserved namespace to provide special JavaScript and HTML to complete authentication with providers via OAuth." Every Firebase project gets it on <project-id>.firebaseapp.com, the subdomain Firebase provisions when the project is created, whether or not you use Firebase Hosting for your app.
Firebase's self-hosting instructions list the files behind it: handler, handler.js, experiments.js, iframe, iframe.js, links, links.js, plus /__/firebase/init.json. So the handler is a small HTML page that loads Firebase's own scripts. It is not a page you build, and your app's router should never answer this path.
Why it must be an authorized redirect URI
Google only sends an OAuth response to a redirect URI registered on the OAuth client. If the redirect_uri "doesn't match an authorized redirect URI for the provided client_id you will get a redirect_uri_mismatch error," and "the http or https scheme, case, and trailing slash ('/') must all match."
For the default setup, the OAuth web client lists:
https://<project-id>.firebaseapp.com/__/auth/handler
https://<project-id>.web.app/__/auth/handler
Firebase's FAQ shows these two values when you rebuild a missing web client by hand, and notes that "Some Firebase Hosting domains don't use Firebase project ID," so copy the exact host. When you move authDomain to your own domain, add https://<your domain>/__/auth/handler as well. Firebase says "the trailing /__/auth/handler is important."
To edit the list (labels as of Oct 2026): Google Cloud console → Google Auth Platform → Clients (older guides: APIs & Services → Credentials) → open the web client whose ID matches the one in Firebase's Google provider settings → Authorized redirect URIs. Google says changes can take "5 minutes to a few hours" to apply.
Common errors and fixes
| What you see | Likely cause | Fix |
|---|---|---|
Google page: Error 400: redirect_uri_mismatch |
The handler URL for your current authDomain isn't on the OAuth client, or differs by scheme, case or trailing slash |
Add https://<authDomain>/__/auth/handler exactly. See fixing redirect_uri_mismatch |
auth/unauthorized-domain, or "This domain YOUR_REDIRECT_DOMAIN is not authorized to run this operation" |
The host isn't in Firebase's Authorized domains, or the API key is invalid | Add the domain under Security → Authentication → Settings → Authorized domains (as of Oct 2026). See Firebase authorized domains |
/__/auth/handler on your domain shows your app, a 404 or a redirect |
Your domain doesn't serve Firebase's helper pages: missing proxy, a catch-all rule first, a 302 instead of a rewrite, or a service worker | Set up the proxy or Firebase Hosting route in how to change authDomain |
The popup or tab opens https://https://… or a path like …/__/auth/handler/__/auth/handler |
authDomain includes a scheme or path |
Set authDomain to the bare host name, for example example.com |
auth/auth-domain-config-required |
authDomain is missing from the config |
Copy it from Project settings → Your apps → Config |
| The handler page says "The requested action is invalid." | The handler couldn't complete the request | See The requested action is invalid |
About the "not authorized" message: Firebase's FAQ notes that "the hostname of the page where you saw this error is your current authDomain." If that host is already listed, its next suspect is an invalid or deleted API key.
About service workers: Firebase warns that a PWA's navigation fallback must exclude this path. "You must disable any fallbacks for the /__ namespace," and "you should not intercept these requests in your service worker."
How to confirm the handler is reachable
- Open the default handler. Run
curl -s https://<project-id>.firebaseapp.com/__/auth/handler. You should get a short HTML page (Firebase'shandlerfile), not an error page. - If you use your own domain, compare the two. A transparent proxy returns the same page:
bash
curl -s https://<project-id>.firebaseapp.com/__/auth/handler > firebase.html
curl -s https://<your domain>/__/auth/handler > mine.html
diff firebase.html mine.html && echo "Same handler"
- Check the OAuth client lists the handler URL for the exact host in your
authDomain. - Run a sign-in in a private window and watch the popup or address bar: it should pass through
https://<authDomain>/__/auth/handlerand return to your app.
Using the Auth emulator? With connectAuthEmulator(), the SDK opens the emulator's own emulator/auth/handler path instead of https://<authDomain>/__/auth/handler.
FAQ
Why does Google show firebaseapp.com when users sign in?
Because the handler runs on your authDomain, which defaults to <project-id>.firebaseapp.com. Firebase's Google sign-in guide says users "may see that domain while signing in to Google." Moving authDomain to your own domain changes it.
Do I need Firebase Hosting for /__/auth/handler to exist?
No. Every Firebase project has it on its default <project-id>.firebaseapp.com host. You only need extra setup (Firebase Hosting with a custom domain, a reverse proxy, or self-hosted helper files) when authDomain points at a domain of your own.
Should I add /__/auth/handler as a route in my app?
No. It is Firebase's page. On your own domain, forward /__/auth/* to https://<project-id>.firebaseapp.com/__/auth/* with a transparent proxy; Firebase says this "cannot be done via a 302 Redirect."
Is the handler used for popup sign-in too, or only redirects?
Both. The SDK builds the same handler URL for popup and redirect flows, and Firebase's nginx example labels the proxy "for signin-helpers for popup/redirect sign in."
Sources
- Best practices for using signInWithRedirect on browsers that block third-party storage access (Firebase)
- Load Firebase SDKs from reserved URLs: Auth helpers and service workers (Firebase Hosting)
- Authentication FAQ and troubleshooting (Firebase)
- Authenticate Using Google with JavaScript (Firebase)
- Learn about using and managing API keys for Firebase (Firebase)
- firebase-js-sdk: packages/auth/src/core/util/handler.ts (GitHub)
- firebase-js-sdk: packages/auth/src/platform_browser/iframe/iframe.ts (GitHub)
- firebase-js-sdk: packages/auth/src/platform_browser/popup_redirect.ts (GitHub)
- firebase-js-sdk: packages/auth/src/core/errors.ts (GitHub)
- Using OAuth 2.0 for Web Server Applications (Google Identity)
- Manage OAuth Clients (Google Cloud Help)
- Authenticate with Firebase using email link: authorized domains step (Firebase)
How this page was made: drafted with AI from the sources listed, reviewed by Pewterkit. Docs checked 26 Oct 2026. Spotted something out of date? Tell us.