Firebase: export user accounts’ email and password hashes

19,615

Solution 1

You can use the firebase-cli by writing firebase auth:export save_file.csv --format=csv or firebase auth:export save_file.json --format=json

More details can be found on the firebase documentation page: https://firebase.google.com/docs/cli/auth#authexport

Solution 2

I did not get any option on firebase console UI. So you need to install firebase tool using npm.

npm install -g firebase-tools

and then login using

firebase login

after login you need to run one of command

CSV Format

firebase auth:export save_file.csv --format=csv --project <project-id>

JSON Format

firebase auth:export save_file.json --format=json --project <project-id>

you can get the project-id from home screen of firebase console

Solution 3

ex corret firebase auth:export save_file.csv --format=csv --project=my-name-project-fb

Share:
19,615
Vlad GURDIGA
Author by

Vlad GURDIGA

Updated on June 06, 2022

Comments

  • Vlad GURDIGA
    Vlad GURDIGA about 2 years

    I use email/password authentication for my Firebase.

    I’m considering moving to a different backend and I’m wondering if there is any way to export user emails/password hashes so that I can authenticate them outside Firebase?

    I would also need to know the hashing algorithm.

  • Vlad GURDIGA
    Vlad GURDIGA about 7 years
    I’ve tried firebase auth:export save_file.json --format=json, but I didn’t get the hashes: { "localId": "020f4fb0-0344-4ff7-bc47-b5e42b00b717", "email": "[email protected]", "createdAt": "1463657902000", "providerUserInfo": [] } Since many of my accounts are created in early 2016, I suspect passwords were not hashed using the scrypt algorithm which is required as per note at the beginning of auth:export command’s docs.
  • Vlad GURDIGA
    Vlad GURDIGA about 7 years
    In any case, I accept this answer because I guess it would work with this recent platform.
  • Kiana
    Kiana over 6 years
    Once you export the users & hashed passwords, you can use github.com/firebase/scrypt to verify user logins.
  • Andrew Irwin
    Andrew Irwin about 5 years
    is there any way to export just the users that have an email attached to their account?
  • Badrush
    Badrush almost 5 years
    Any idea why when I run this, it works, but in console it keeps repeating the message Exporting accounts to auth_export.csv ✔ Exported 289 account(s) successfully. ✔ Exported 289 account(s) successfully. ✔ Exported 289 account(s) successfully. ✔ Exported 289 account(s) successfully.
  • Badrush
    Badrush almost 5 years
    And the exported file ends up containing the data repeated several times.
  • Admin
    Admin almost 5 years
    It is usually best to explain how your answer addresses the question.
  • David Chopin
    David Chopin over 4 years
    Same issue here, it seems to endlessly loop/append repeating data unless you cancel the command after the first success message
  • tjeisenschenk
    tjeisenschenk about 4 years
    Is there any chance that this CLI command will include custom-claims in the future as well?
  • Nat Aes
    Nat Aes almost 4 years
    This may be a bit of a stupid question, but where is the exported file (save_file.csv or save_file.json) saved to? I get the message that Exported 56 account(s) successfully but can't locate a save_file.csv on my local PC.
  • Jürgen Brandstetter
    Jürgen Brandstetter almost 4 years
    For me, it's always in the same folder I start the script from.
  • Adeel Shekhani
    Adeel Shekhani over 2 years
    When I run firebase auth:export I get "An unexpected error has occurred. "