Skip to content

Firebase Auth to Keycloak user converter

Turn the JSON from firebase auth:export into Keycloak users: emails, verified flags, display names, custom claims as attributes and groups, without the password hashes.

Runs in your browser. Nothing you paste is sent to us.

Firebase export

The file firebase auth:export writes with --format=json. Made-up users are filled in. It stays in your browser.

Falls back to the other when a user has none. Usernames are written in lower case.

The custom claim that holds groups, such as groups or roles. Leave it empty for none.

Output

Keycloak users

3 users 2 set a new password 1 sign in with a provider

Records read
3
Users in the file
3
Left out
0
Set a new password by email link
2Marked with the Update Password required action
Social or enterprise sign-in only
1Re-link by email at their first sign-in
Disabled in the source
1
In groups
1/staff
Attributes
2firebase_uid, tier
Password hashes left out
2Keycloak cannot verify them, so the file never holds them
JSON
{
  "groups": [
    {
      "name": "staff",
      "subGroups": []
    }
  ],
  "users": [
    {
      "username": "[email protected]",
      "email": "[email protected]",
      "emailVerified": true,
      "firstName": "Sample",
      "lastName": "One",
      "enabled": true,
      "createdTimestamp": 1709370900000,
      "attributes": {
        "tier": [
          "gold"
        ],
        "firebase_uid": [
          "sampleUid001"
        ]
      },
      "groups": [
        "/staff"
      ],
      "requiredActions": [
        "UPDATE_PASSWORD"
      ]
    },
    {
      "username": "[email protected]",
      "email": "[email protected]",
      "emailVerified": true,
      "firstName": "Sample",
      "lastName": "Two",
      "enabled": true,
      "attributes": {
        "firebase_uid": [
          "sampleUid002"
        ]
      }
    },
    {
      "username": "[email protected]",
      "email": "[email protected]",
      "emailVerified": false,
      "enabled": false,
      "attributes": {
        "firebase_uid": [
          "sampleUid003"
        ]
      },
      "requiredActions": [
        "UPDATE_PASSWORD"
      ]
    }
  ]
}
Read but not carried over
  • passwordHash, salt: Keycloak cannot verify this hash, so it is left out (Firebase’s modified scrypt).
  • mfaInfo: MFA secrets are not in this export; users enroll again.
  • providerUserInfo: Used to tell password users from social ones, then left out.
  • lastSignedInAt: Sign-in history does not move.
In the admin console: Realm settings, Action, Partial import. Choose Skip or Fail for users that already exist. Keycloak keeps only attributes its user profile declares, unless the realm allows unmanaged attributes: add them to the user profile first.

How to use it

  1. Run firebase auth:export users.json --format=json.
  2. Paste the file or open it here.
  3. Name the custom claim that holds groups, if any.
  4. Save the import file and test it on a staging realm.

What to know

Firebase hashes passwords with its own modified scrypt. Keycloak does not ship a verifier for it, so the hashes and salts are left out and password users set a new password by email link.

Custom claims become attributes, and the claim you name becomes groups. Display names are split at the first space into first and last name; check names that do not fit that pattern.

Users who signed in with Google, Apple or another provider get no password step. They re-link by email at their first sign-in.

Moving users from Firebase Authentication to Keycloak

Firebase Authentication keeps users in a project, with an email, a verified flag, a display name, the providers they sign in with and any custom claims you set. Keycloak keeps users in a realm, with a username, an email, first and last name, attributes, groups and credentials. The two line up well, apart from the password.

This converter reads the JSON file that firebase auth:export writes and turns it into a Keycloak partial import or realm import file. It runs in your browser. It leaves out every password hash and salt, marks password users with the Update Password required action, and lists what it could not carry over.

For the whole move, with the plan, the user emails and the cut-over, see moving from Firebase.

Exporting users from Firebase

The Firebase CLI exports every user of a project to a file. Use JSON, which keeps nested data such as provider lists and second factors; the CSV format flattens them into fixed columns.

Export a project’s users as JSON
firebase auth:export users.json --format=json --project <project-id>

Each user in the file can have these fields: localId, email, emailVerified, passwordHash, salt, displayName, photoUrl, createdAt, lastSignedInAt, phoneNumber, disabled, customAttributes, mfaInfo and providerUserInfo, the list of linked providers with their own ids.

The export holds password hashes for users whose passwords use Firebase’s default scrypt. Treat the file as a secret even though this tool leaves the hashes out of its output.

Why passwords do not move

Firebase hashes passwords with a modified version of scrypt, which is the default for Firebase projects. Verifying one of those hashes needs the project’s hash parameters too: the signer key, the salt separator, the rounds and the memory cost, which the Firebase console shows under the users list.

Keycloak ships hash providers for Argon2 and the PBKDF2 family, and none for Firebase’s scrypt. A Firebase hash imported as a Keycloak credential would never match. RealmDeploy clusters run the stock Keycloak image without custom providers, so a custom scrypt provider cannot be added today. We are evaluating one; until it exists on our clusters, Firebase password users set a new password by email link after the move.

The tool counts how many records held a hash, so you can see what was left out, and writes none of them.

What the tool does with each field

Firebase fieldKeycloak userNotes
emailemail, in lower caseAlso the username by default
emailVerifiedemailVerifiedKept as it was
displayNamefirstName, lastNameSplit at the first space
disabledenabled: falseOr left out, if you choose
createdAtcreatedTimestampAlready in milliseconds
localIdThe firebase_uid attributeKeep it to match app data
customAttributesUser attributesThe JSON of your custom claims
The claim you name for groupsgroups, as pathsSuch as groups or roles
phoneNumber, photoUrlphoneNumber, picture attributesKeycloak has no built-in fields for them
providerUserInfoWho sets a password, who re-linksNot written to the file

Left out, and listed in the result: passwordHash and salt, mfaInfo, and lastSignedInAt.

Display names

Firebase has one display name; Keycloak has a first and a last name, and its default user profile asks for both. The tool takes the first word as the first name and the rest as the last name. That suits many names and not all of them. Check the result for names written family name first, or with one word only. A user with an empty last name is asked to complete the profile at the next sign-in, which is a fine outcome too.

Custom claims, attributes and groups

Custom claims are a JSON object you set with the Admin SDK, such as {"groups": ["staff"], "tier": "gold"}. The claim you name becomes Keycloak groups, and the others become attributes. Nested objects become dotted attribute names, and lists stay lists.

Apps that read a claim from the Firebase ID token will need the same claim in the Keycloak token. Add the attribute to the realm’s user profile, then a user attribute mapper on the client scope, so the token carries it under the same name.

Social and phone sign-in

A user whose providers include google.com, apple.com or another social provider gets no password step. Once you set up that identity provider in Keycloak, their first sign-in finds the account by email and asks them to confirm the link.

A phone-only user has no email, so no set-password link can reach them. Keycloak has no SMS sign-in out of the box; the tool lists these users as warnings so you can decide what to do with them.

The output

Sample output for one made-up user
{
  "users": [
    {
      "username": "[email protected]",
      "email": "[email protected]",
      "emailVerified": true,
      "firstName": "Sample",
      "lastName": "One",
      "enabled": true,
      "createdTimestamp": 1709370900000,
      "attributes": {
        "tier": ["gold"],
        "firebase_uid": ["sampleUid001"]
      },
      "groups": ["/staff"],
      "requiredActions": ["UPDATE_PASSWORD"]
    }
  ]
}

With “Create the groups in the same file” on, the file also lists the groups, so a partial import creates them before it adds the users. The preview shows 20 users; the saved file has all of them.

Importing and sending the set-password emails

  1. Add your attributes to the realm’s user profile.
  2. Configure the realm’s SMTP connection and send a test email.
  3. Set up the social identity providers your users had in Firebase.
  4. Import the file into a staging realm with Partial import, and compare counts with the summary.
  5. Test a password user and a social user end to end.
  6. Import into production at cut-over and send the set-password emails.

Keycloak sends the set-password email when an admin uses Credential reset on a user, or when a script calls the execute-actions-email endpoint with ["UPDATE_PASSWORD"]. The link opens Keycloak’s Update Password page, and it lasts as long as you choose. If the realm allows Forgot password on the sign-in page, users who miss the email can ask for a new link themselves.

Tell users before the email arrives, so they trust it. The migration email templates give you an announcement, an email for the day and a reminder.

Switching your apps from Firebase tokens

Users are half of a Firebase move; the apps are the other half. Firebase apps sign in through the Firebase Auth SDK and send a Firebase ID token to your backend, which verifies it with the Admin SDK. After the move, apps sign in with OpenID Connect and send a Keycloak access token, which your backend verifies against the realm’s keys.

TodayAfter the move
Firebase Auth SDK in a web appAn OpenID Connect library, the authorization code flow with PKCE
Firebase Auth SDK in a mobile appAn AppAuth library, the system browser, and a custom scheme or app link as redirect URI
verifyIdToken in your backendJWT verification against /realms/<realm>/protocol/openid-connect/certs
request.auth in security rulesRules that read your own backend’s checks, since Firebase rules trust Firebase tokens
uid as the key of user datafirebase_uid attribute mapped into the token, or a lookup on first sign-in

Mobile apps set the pace. A new release has to reach users before the cut-over, and users who do not update keep the old sign-in. Plan a release that can sign in with Keycloak, ship it ahead of the date, and keep Firebase Authentication running until most users have it.

If Firestore or Realtime Database rules check request.auth, they trust only Firebase tokens. Moving away from Firebase Authentication means those reads and writes go through your own backend, or through custom tokens you mint after checking a Keycloak token. Decide which before you set a date.

Checking the result

After the dry run import, compare three numbers with the summary: users in the realm, users with the Update Password action (under Users, filter by required action in the admin API), and users in each group. Then open three or four users and compare their attributes with the Firebase console.

Sign in as a test user from each app and read the token with the JWT decoder. The claims your app reads must be there under the same names.

Mistakes to avoid

  • Exporting as CSV and losing the provider list, which tells password users from social ones.
  • Importing passwordHash as a Keycloak credential. It will not verify.
  • Forgetting that Firebase allows one account per email only when the project is set that way. Duplicate emails are kept once and listed.
  • Leaving apps on Firebase ID tokens. Each app must switch to Keycloak’s issuer and its keys.
  • Keeping users.json after the move. It holds hashes; delete every copy.

Where we come in

On Premium and Enterprise, our team does the move with you within the plan’s 10 service hours a month. On Starter, you use these tools and guides, with written support for questions. Very large moves are scoped as Custom through the contact form. The readiness checklist has every step for a Firebase move.

Questions

Frequently asked questions

Can Firebase users keep their passwords in Keycloak?

Not today. Firebase uses a modified scrypt and Keycloak ships no provider for it, so users set a new password by email link. We are evaluating an scrypt provider.

Which export format should I use?

JSON, from firebase auth:export with --format=json. It keeps the provider list and custom claims whole.

What happens to custom claims?

They become user attributes, except the claim you name for groups, which becomes Keycloak group paths.

Do Google and Apple users need a new password?

No. They sign in with the same provider in Keycloak and confirm the link to their account by email or by signing in.

Does MFA move from Firebase?

No. The export lists second factors, but a TOTP enrollment holds no secret, so users enroll again.

Can I keep Firebase user ids?

Keycloak makes its own user ids. The tool keeps the Firebase uid as the firebase_uid attribute, so your app can match its records.

Is my file uploaded?

No. The tool runs in your browser and the saved file is made on your computer.

Rather not run Keycloak yourself?

We run it for you on a cluster of your own, with backups, upgrades and written support. Starter and Premium begin with a 7-day trial.