Firebase: export user accounts’ email and password hashes
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
Vlad GURDIGA
Updated on June 06, 2022Comments
-
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 about 7 yearsI’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 ofauth:export
command’s docs. -
Vlad GURDIGA about 7 yearsIn any case, I accept this answer because I guess it would work with this recent platform.
-
Kiana over 6 yearsOnce you export the users & hashed passwords, you can use github.com/firebase/scrypt to verify user logins.
-
Andrew Irwin about 5 yearsis there any way to export just the users that have an email attached to their account?
-
Badrush almost 5 yearsAny 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 almost 5 yearsAnd the exported file ends up containing the data repeated several times.
-
Admin almost 5 yearsIt is usually best to explain how your answer addresses the question.
-
David Chopin over 4 yearsSame issue here, it seems to endlessly loop/append repeating data unless you cancel the command after the first success message
-
tjeisenschenk about 4 yearsIs there any chance that this CLI command will include custom-claims in the future as well?
-
Nat Aes almost 4 yearsThis 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 almost 4 yearsFor me, it's always in the same folder I start the script from.
-
Adeel Shekhani over 2 yearsWhen I run firebase auth:export I get "An unexpected error has occurred. "