firebase-tools icon indicating copy to clipboard operation
firebase-tools copied to clipboard

Firebase auth import from firebase to firebase

Open zetos opened this issue 9 years ago • 11 comments

Hello, i am having some issues while trying to migrate auth users from one firebase project to another.

I followed this steps to get a json of the auth users in a project. Now i need to import them to another firebase project.

looking at the auth:import commands i would need the hash-algo for the import command, wish i found here that the new firebase is now using SCRYPT. But i still need the rounds and i guess the mem-cost for the import command.

zetos avatar Jan 31 '17 21:01 zetos

Does it work if you leave those parameters out?

Jeroeny avatar Feb 01 '17 09:02 Jeroeny

No, if i enter the command: $ firebase auth:import users.json --hash-algo=SCRYPT

i get the error: Error: Must provide valid rounds(1..8) for hash algorithm SCRYPT

zetos avatar Feb 01 '17 12:02 zetos

If you contact custom support, they can give you detailed parameters for SCRYPT. But currently, the auth:import code still has a bug. It needs to pick up hash-key from command line options which I ignored before. We'll publish a new version to fix it and make sure the migration can work for you.

BTW, our auth:export will be available soon. This one will be deprecated.

Thanks.

wyhao31 avatar Feb 02 '17 08:02 wyhao31

Good to know,

Thanks for the help.

zetos avatar Feb 02 '17 20:02 zetos

Hey zetos,

New auth:import and auth:export are available now! You can check the doc for more details.

wyhao31 avatar Feb 16 '17 19:02 wyhao31

I still get error ! No hash algorithm specified. Password users cannot be imported. when I leave parameters out in auth:import. In this case users are created, but passwords don't work (INVALID_PASSWORD errors on login) If I type firebase auth:import users.json --hash-algo=scrypt --rounds=8 --mem-cost=14 as in given example here, I get Error: Must provide hash key(base64 encoded) for hash algorithm scrypt

bogacg avatar Mar 01 '17 13:03 bogacg

Hi Bogac,

You still need hash key and salt separator for scrypt. Doc is here. You can contact customer support to get these two parameters.

We need to update the doc you attached. Thanks.

wyhao31 avatar Mar 01 '17 17:03 wyhao31

Right now the only way to get those parameters is by contacting the custom support.

zetos avatar Mar 21 '17 02:03 zetos

These details are available through firebase admin now. Navigate to

Console > Project > Authentication > Three little dots on right side of all users > Password Hash Credentials

image

realpratiknikam avatar Jan 26 '18 19:01 realpratiknikam

I feel like we should add @pratiknikam 's response to the documentation for auth:export and auth:import.

We should also specify --project under an example command line.

I.E. Screen Shot 2020-09-04 at 3 22 22 PM

And add --project projectid

Otherwise, it's hard to go find the parameter to specify the project that we are trying to import to.

ptkpyitheim avatar Sep 04 '20 20:09 ptkpyitheim

@ptkpyitheim that's a good idea, I'll add a note about password hash parameters.

samtstern avatar Sep 08 '20 13:09 samtstern