Skip to content

Firebase Auth error

Firebase Auth: auth/user-token-expired

auth/user-token-expired is the Firebase Auth error when the user’s refresh token is no longer valid. That happens when the user changes password or email on another device, or an admin revokes the tokens. A deleted or disabled user usually gets auth/user-not-found or auth/user-disabled instead.

Rather hand it over? App Fix Ticket: One reproducible bug in an existing mobile or web app, diagnosed and fixed.The Fix is $1,200 in total. The $450 Diagnosis is optional and credited toward it.

Full refund if Simon can’t take it on once he sees your project, or if you cancel before work starts. Refund terms.

Short answer

Catch the error wherever the app gets an ID token or calls Firebase, sign the user out cleanly, and send them to the sign-in screen with a short message. Don’t retry the same session: it can’t be refreshed.

Rather not fix it yourself? App Fix Ticket fixes one reproducible bug at a fixed price, with an optional Diagnosis that is credited toward the fix.

Why the session ended, and the fix

  1. 01

    The password or email changed elsewhere

    “This includes events like password or email address updates.” Firebase, Manage user sessions

    A password reset on the web ends sessions on the phone. Treat the error as a normal sign-out and ask the user to sign in again.

    try {
      const token = await auth.currentUser?.getIdToken();
    } catch (error) {
      if (error.code === 'auth/user-token-expired') {
        await signOut(auth); // the web SDK signs out too; native SDKs may not
        router.push('/sign-in?reason=session-ended');
      }
    }
  2. 02

    The user was deleted or disabled (usually a different code)

    “Refresh tokens expire only when one of the following occurs:” Firebase, Manage user sessions

    Deleting or disabling the account ends every session too, but expect auth/user-not-found or auth/user-disabled there. Handle all three the same way. A disabled user can be re-enabled; a deleted user has to sign up again.

  3. 03

    An admin revoked the tokens

    “The Firebase Admin SDK provides the ability to revoke refresh tokens for a specified user.” Firebase, Manage user sessions

    Server code that calls revokeRefreshTokens, for example after a security event, signs the user out everywhere. That is expected; show the sign-in screen.

  4. 04

    The app keeps retrying

    Also check: a loop that retries getIdToken on every error spins forever here. Stop on this code and sign out.

Checked against the vendor’s docs on : Firebase docs: Manage user sessions.

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
Read 126 of the 127 Fiverr reviews

Related: Firebase auth/requires-recent-login · Firebase auth/user-disabled · Firebase auth/invalid-verification-code · Firebase auth/invalid-user-token

Questions

More on this error

Do ID tokens expire too?

Yes, after about an hour, but the SDK refreshes them on its own. This error means the refresh itself failed, so a new sign-in is needed.

Can I keep users signed in after a password change?

Not on other devices. A password or email change ends those sessions on purpose.

Can you fix it for me?

If one bug is the whole problem, the App Fix Ticket covers it. If you already know the cause, you can pay for the fix directly; if not, start with a written diagnosis, which is credited toward 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?

Ask Simon for a price range

Send the error and what you were doing. Simon replies by email, usually within one business day, with a price range.