auth:import

The auth:import command imports user accounts into a Firebase project.

Syntax

firebase auth:import account_file \
    --hash-algo=hash_algorithm    \
    --hash-key=key                \
    --rounds=rounds               \
    --mem-cost=mem_cost
Parameters
account_file The CSV or JSON file that contains the user accounts to import. See File format.
hash-algo The algorithm used to hash passwords in the user account file. Required. One of the following values: BCRYPT, SCRYPT, HMAC_SHA512, HMAC_SHA256, HMAC_SHA1, HMAC_MD5, MD5, PBKDF_SHA1.
hash-key The base64-encoded key used to hash passwords. Required for the HMAC_SHA512, HMAC_SHA256, HMAC_SHA1, and HMAC_MD5 algorithms.
rounds The number of rounds used to hash passwords. Required for the SCRYPT, MD5, and PBKDF_SHA1 algorithms.
mem-cost The memory cost of the hashing algorithm. Required for the SCRYPT algorithm.

File format

The user account file can be formatted as CSV or JSON.

CSV

A CSV user account file has the following format:

Column number Field description Field type Comments
1 UID String Required. This ID should be unique among all accounts in your Firebase projects. If you import an account with a UID that already exists, the account will be overwritten.
2 Email String Optional
3 Email Verified Boolean Optional
4 Password Hash String Optional. A base64 encoded string.
5 Password Salt String Optional. A base64 encoded string.
6 Name String Optional
7 Photo URL String Optional
8 Google ID String Optional
9 Google Email String Optional
10 Google Display Name String Optional
11 Google Photo URL String Optional
12 Facebook ID String Optional
13 Facebook Email String Optional
14 Facebook Display Name String Optional
15 Facebook Photo URL String Optional
16 Twitter ID String Optional
17 Twitter Email String Optional
18 Twitter Display Name String Optional
19 Twitter Photo URL String Optional
20 GitHub ID String Optional
21 GitHub Email String Optional
22 GitHub Display Name String Optional
23 GitHub Photo URL String Optional

For example, the following line represents a user account:

111, test@test.org, false, Jlf7onfLbzqPNFP/1pqhx6fQF/w=, c2FsdC0x, Test User, http://photo.com/123, , , , , 123, test@test.org, Test FB User, http://photo.com/456, , , , , , , , ,

JSON

A JSON user account file has the following format:

{
  "users": [
    {
      "localId": uid,
      "email": email-address
      "emailVerified": email-verified,
      "passwordHash": password-hash,
      "salt": password-salt,
      "displayName": name,
      "photoUrl": photo-url,
      "providerUserInfo": [
        {
          "providerId": provider-id,
          "rawId": provider-uid,
          "email":  provider-email,
          "displayName": provider-name,
          "photoUrl": provider-photo-url
        },
        ...
      ]
    },
    ...
  ]
}

The providerId field must be one of the following values: google.com, facebook.com, github.com, twitter.com.

Send feedback about...

Need help? Visit our support page.