Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import users with cli auth:import #4145

Closed
bpingris opened this issue Feb 9, 2022 · 7 comments
Closed

Import users with cli auth:import #4145

bpingris opened this issue Feb 9, 2022 · 7 comments

Comments

@bpingris
Copy link

bpingris commented Feb 9, 2022

[REQUIRED] Environment info

firebase-tools:
10.1.2

Platform:
macOS

[REQUIRED] Test case

I want to import some users from an external service to firebase.

[REQUIRED] Steps to reproduce

I created a users.json file with the following content:

{
    "users":  [
        {
            "localId": "6163ee1c5235bc04593462fe",
            "email": "jon.foo@example.com",
            "passwordHash": "12c95403688627611328f4e293f76520939563f87ee3d8c2e97e5f0fac4690ba",
            "salt": "M2U4MjRhNWEtMGFlMS00YjZmLThmMjUtNTU0NDMyZTc5NTRm"
        }
    ]
}

and ran this command:

firebase auth:import users.json \
--hash-algo=SHA256 \
--rounds=1 \
--hash-input-order=SALT_FIRST \
--project my-project-id

[REQUIRED] Expected behavior

The users defined in my users.json should be uploaded to firebase, or if any error happened I should have it displayed on my terminal.

[REQUIRED] Actual behavior

The import failed and I have no information except the following:

Processing users.json (310 bytes)
Starting importing 1 account(s).
Encountered problems while importing accounts. Details:

If I ran with --debug flag , I can see the error but it seems wrong:

[{"account":"{}","reason":"localId is missing"}]

but, as you can see in my users.json, the localId property is set.

@bpingris bpingris added the bug label Feb 9, 2022
@google-oss-bot
Copy link
Contributor

This issue does not seem to follow the issue template. Make sure you provide all the required information.

@bobatsar
Copy link

bobatsar commented Feb 9, 2022

I have exactly the same issue. It is not possible to import auth data with passwords at the moment. But in my case I am just trying to import data from a backup which was exported with firebase auth:export auth.json --format json

In my case it is firebase 10.1.5 on Ubuntu 21.10

@nappernick
Copy link

nappernick commented Feb 9, 2022

Same issue. firebase-tools 9.18.0 and firebase 8.10.0, platform is MacOS Big Sur.

@antoine10245
Copy link

antoine10245 commented Feb 10, 2022

Im experiencing it too! using firebase 10.1.5, on macOS Monterey(12.1)
when running firebase --debug auth:import usersToImport.json --hash-algo="MD5" --rounds=1

here is an example of what Im trying to import

{
    "users": [
        {
            "localId": "7022f2de-1b41-4a75-aa9e-575b9ae8a056",
            "email": "user1@mail.com",
            "passwordHash": "NWI3ZWU1NGJiMDFlY2I2OGM4NDZlOGJhNTk5YjdkNGM=",
            "createdAt": 1644495378041
        }
    ]
}

@bpingris
Copy link
Author

To resolve this in the meantime, I used the Go admin SDK to import my users (btw all SDK seem not to be developed with the same feature: the Node one does not have an option to specify the order of the salt).
I had to face some issues though, you can find more information on my SO post

@isaactan001
Copy link

isaactan001 commented Feb 10, 2022

Use the CSV format instead of JSON works for me

Export
firebase auth:export users.csv --format=csv --project=myproject1

Import
firebase auth:import users.csv --project=myproject2 --hash-algo=scrypt --hash-key=myhashkey --rounds=8 --mem-cost=14 --debug

@yuchenshi
Copy link
Member

Duplicate of #4157

@yuchenshi yuchenshi marked this as a duplicate of #4157 Feb 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants