DEV Community

Cover image for Firebase: Move authenticated users to another project
Abraham Kolawole
Abraham Kolawole

Posted on

Firebase: Move authenticated users to another project

Firebase is a popular framework used by a lot of developers and companies to build high-quality applications.

With features such as Authentication management, real-time database, and storage management, Firebase is a framework to utilize.

Today, we are going to consider how to transfer authenticated users from one firebase project to another. Sometimes we may need to move our user data from one firebase project to another because of shared resources. Firebase makes it very easy to accomplish this by running a few lines of code in your terminal.

Steps to transfer Authenticated users from one project to another

In your terminal, do the following:

firebase login

This would log you into your Firebase account using the Firebase CLI tool.

Next, run:

firebase projects:list

This would list the firebase projects you have.

Next, run the command below to use the firebase projects which hold the users you would like to export to the other project:

firebase use projectid

The next step would be to export the users using

firebase auth:export filename.json --project projectId

This would export the users in your current folder in a JSON format. If you would like the file format to be in a CSV format, use

firebase auth:export filename.csv --project projectId

We can then import the exported users into the new projects by executing

firebase auth:import filename.json --hash-algo=** --rounds=** --mem-cost=** --hash-key=** --salt-separator=**

You can get the values for the algorithm, rounds, salts, etc., from your firebase projects.

  1. Open the firebase project that contains the Authenticated Users you have exported.
  2. Navigate to the Authentication tab.
  3. Click on the menu button (Three dot icon) and click on Password hash parameters.
  4. The values for the command above would be revealed to you.

Once you run the command above, the users will be transferred to the new project.

Thank you for reading.

For more blogs, visit http://www.abrahamkolawole.com/blog

Top comments (0)