AuthenticationMigration3 min readUpdated September 2026

Migrating From Firebase Auth to Clerk, Step by Step

To migrate from Firebase Auth to Clerk, inventory every sign-in method and custom claim, export users, import them with a stable external ID, run both token verifiers side by side, then cut clients over in stages. The hard parts are password hashes and every place your backend trusts a Firebase token.

This runbook is written for a small team that can't afford to lock customers out. It favors reversible steps over a single big-bang weekend.

Vendors Covered in this Article

Disclosure: We may earn a commission if you buy through some links on this page. It doesn't change what we recommend.

What should you inventory before touching any code?

Migrations fail on things nobody wrote down. Before exporting anything, list:

  • Every sign-in method in use: email and password, each social provider, phone, anonymous, and custom tokens minted by your own server.
  • Every custom claim you set (roles, plan, organization IDs) and every service that reads them.
  • Every place the UID appears as a foreign key in your own database, in Firestore rules, in storage paths or in third-party tools.
  • Every backend that verifies Firebase ID tokens, including workers, webhooks and mobile apps that are slower to update.
  • Email templates and action links for verification and password reset.

The UID list matters most. Plan to keep the old UID as an external identifier on the new user record so existing foreign keys keep working while you migrate.

How do you move users and password hashes?

Export users with the Firebase CLI or Admin SDK, which gives you emails, verification state, provider links, metadata and, for password users, a hash and salt. Firebase's password hashing uses a modified scrypt with project-specific parameters, so importing hashes only works if the target accepts that algorithm and you supply the parameters. Check Clerk's current import documentation before you assume it does.

If hashes can't be imported, you have two fallbacks. You can email password-reset links to every password user, which is simple but produces churn. Or you can migrate lazily: on login, verify the password against Firebase, then create or update the user in Clerk with the password the person just typed. Lazy migration keeps people signed in smoothly, but it means running the Firebase check longer, and inactive users never migrate. Social-login users are easier, since they re-authenticate with the same provider and match by email.

How to run both systems during the transition

The safest path is dual verification, where your backend accepts either a Firebase ID token or a Clerk session token during the window. A sequence that works:

  1. Add a token verification layer that inspects the issuer and routes to the right verifier, returning the same internal user object either way.
  2. Backfill the mapping table from Firebase UID to Clerk user ID before any client changes ship.
  3. Move claims into the new system: roles and plan fields become organization roles or public metadata, and your authorization code reads them through one helper.
  4. Ship the new sign-in UI to a small share of traffic or an internal group first, and watch error rates on login and token verification.
  5. Roll out to web, then mobile, keeping the Firebase path live for app versions that haven't updated.

Keep webhooks in mind. If you sync users to your own database when they sign up, point that at Clerk's events and make the handler idempotent, so a user created by import and by webhook doesn't duplicate.

Pitfalls that cause lockouts

The failures that hurt are predictable:

  • Case and whitespace differences in email addresses causing duplicate or orphaned users during import.
  • OAuth redirect URIs registered only for the old provider, so social sign-in breaks on cutover day.
  • Security rules or row-level policies that reference the Firebase UID claim and silently deny access to migrated users.
  • Sessions: users signed in on Firebase have no Clerk session yet, so decide whether the first visit shows a quiet re-login.
  • Deleting the Firebase project too early. Keep it read-only for at least one full billing cycle.

What does your rollback plan look like?

Write the rollback before the cutover. The minimum: a feature flag that flips clients back to the Firebase sign-in, a backend that still accepts Firebase tokens, and a rule that no user data is deleted from Firebase until you've run cleanly for a set period.

One catch is password changes made during the window. If someone resets a password in Clerk and you then roll back, Firebase has the old one. Freeze password changes during the cutover window or tell affected users. For your related authentication decisions, see multi-tenant authentication architecture and the Clerk vs Auth0 comparison for B2B SaaS.

Executive Capability Standard

What Good Looks Like

A migration that can be reversed at any step, where every user keeps access and every backend check works against both token types until the old one is retired.

Building The Capability (5-Stage Skill Ladder)

1. Learn:Read the current import and session-token documentation for both providers and note where your hash format and custom claims map.
2. Do Manually:Export a sample of fifty users, import them into a test instance, and confirm sign-in for password, social and phone users.
3. Delegate:Give one engineer ownership of the dual-verification layer and another the backfill script, with a shared checklist.
4. Automate:Script the export, mapping-table backfill and reconciliation report so you can rerun them before cutover and compare user counts.
5. Buy:Consider paid migration support from the new provider if you have complex hashes, many tenants or strict downtime limits.

How to Get Started

Disclosure: We may earn a commission if you buy through some links on this page. It doesn't change what we recommend.

Clerk

Fits if you want prebuilt sign-in components and organization handling for a React or Next.js app, and you're willing to map your Firebase claims onto them.

Visit Clerk→

Frequently Asked Questions

Can I keep my existing Firebase UIDs after migrating?

Yes, store the old UID as an external ID or metadata field on each new user, and keep a mapping table. That keeps foreign keys in your own database valid while you update code to use the new identifier over time.

What happens to users who signed up with a password?

It depends on whether the new provider accepts your Firebase hash format and parameters. If it does, import them directly. If not, use lazy migration on login or send password-reset emails. Check the provider's current documentation.

How long should both systems run in parallel?

Long enough for every client version to update and for inactive users to have a chance to sign in, often a few weeks. Track the share of traffic still using Firebase tokens and retire the path when it reaches zero.

Should I migrate everyone at once?

Usually no. A staged rollout, starting with internal accounts and then a small share of real traffic, lets you catch claim mapping and redirect problems while a rollback is still cheap.

About the numbers

This guide doesn't quote a sourced benchmark. Figures in it are estimates or general guidance, so check them against your own numbers.

Related Guides