Migrate from Firebase
Migrating your user base from Firebase to Clerk is a 2-part process that can be accomplished with just a few steps.
Log in to Firebase
Login into your Firebase account via the CLI.
Find your Firebase project ID
Use the firebase CLI to list your projects and find the project ID you want to export.
Export your Firebase users using the CLI
Use the firebase CLI to export your users to a JSON file.
Here's what this command is doing:
-
firebase auth:export
: it tells Firebase you're trying to export the user base. -
firebase-users.json
: the name of the file you're about to create. -
--format=json
: make it a JSON file. -
--project <YOUR_PROJECT_ID>
: it tells Firebase which project you're trying to export from. Don't forget to replace<YOUR_PROJECT_ID>
with the Project ID you found in the previous step.
You should now have a JSON file called firebase-users.json
that contains all your Firebase users.
Retrieve your password hash parameters
In your Firebase project’s dashboard, navigate to Authentication and click on the 3 vertical dots at the top of the user's list, then click on Password hash parameters.
On the new window that opens, you'll find the following values: base64_signer_key
, base64_salt_separator
, rounds
and mem_cost
.
You can find more information about this page and the values above on Firebase's documentation.
Create a Node.js script
Now you have all the information you need to import your Firebase users into Clerk. This example uses Node.js, but you can use any other language or method if you so wish.
init npm
Here, body will either hold the necessary information to migrate a password-based user or in the case of an OAuth-based user, it'll skip the password check. It will also have the previous user ID as external_id
, so you can link the newly created users with their existing data.
Run the script
Once the script has finished running, your user base will be fully migrated to Clerk.
Feedback
Last updated on