Migrate from Firebase Auth to Supabase
Migrate Firebase auth users to Supabase Auth.
Supabase provides several tools to help migrate auth users from a Firebase project to a Supabase project. There are two parts to the migration process:
- firestoreusers2json(TypeScript, JavaScript) exports users from an existing Firebase project to a- .jsonfile on your local system.
- import_users(TypeScript, JavaScript) imports users from a saved- .jsonfile into your Supabase project (inserting those users into the- auth.userstable of your- Postgresdatabase instance).
Set up the migration tool
- 
Clone the firebase-to-supabaserepository:1git clone https://github.com/supabase-community/firebase-to-supabase.git
- 
In the /authdirectory, create a file namedsupabase-service.jsonwith the following contents:1234567{ "host": "database.server.com", "password": "secretpassword", "user": "postgres", "database": "postgres", "port": 5432}
- 
On your project dashboard, click Connect 
- 
Under the Session pooler, click on the View parameters under the connect string. Replace the HostandUserfields with the values shown.
- 
Enter the password you used when you created your Supabase project in the passwordentry in thesupabase-service.jsonfile.
Generate a Firebase private key
- Log in to your Firebase Console and open your project.
- Click the gear icon next to Project Overview in the sidebar and select Project Settings.
- Click Service Accounts and select Firebase Admin SDK.
- Click Generate new private key.
- Rename the downloaded file to firebase-service.json.
Save your Firebase password hash parameters
- Log in to your Firebase Console and open your project.
- Select Authentication (Build section) in the sidebar.
- Select Users in the top menu.
- At the top right of the users list, open the menu (3 dots) and click Password hash parameters.
- Copy and save the parameters for base64_signer_key,base64_salt_separator,rounds, andmem_cost.
1234567hash_config {  algorithm: SCRYPT,  base64_signer_key: XXXX/XXX+XXXXXXXXXXXXXXXXX+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX==,  base64_salt_separator: Aa==,  rounds: 8,  mem_cost: 14,}Command line options
Dump Firestore users to a JSON file
node firestoreusers2json.js [<filename.json>] [<batch_size>]
- filename.json: (optional) output filename (defaults to- ./users.json)
- batchSize: (optional) number of users to fetch in each batch (defaults to 100)
Import JSON users file to Supabase Auth (Postgres: auth.users
node import_users.js <path_to_json_file> [<batch_size>]
- path_to_json_file: full local path and filename of JSON input file (of users)
- batch_size: (optional) number of users to process in a batch (defaults to 100)
Notes
For more advanced migrations, including the use of a middleware server component for verifying a user's existing Firebase password and updating that password in your Supabase project the first time a user logs in, see the firebase-to-supabase repo.
Resources
Migrate to Supabase
Contact us if you need more help migrating your project.