Moving users from Auth0 to Keycloak
Auth0 and Keycloak describe a user in much the same way: an id, an email address, a verified flag, names, some custom data and the ways the person signs in. The files look different, though. Auth0 exports users as newline-delimited JSON with its own field names, and Keycloak imports users as one JSON document in the shape of its realm export.
This converter reads the Auth0 export and writes the Keycloak file. It runs in your browser, so the export never leaves your computer. It writes no password and no hash, and it tells you, user by user, who will have to set a new password and who signs in through a provider and only needs to confirm a link.
The page explains what Auth0 exports, what Keycloak accepts, what the tool does with each field, and the decisions you still make yourself. For the whole move, from inventory to rollback, see moving from Auth0.
Getting the export out of Auth0
Auth0 has two kinds of export, and they hold different things.
| Export | How you get it | What it holds |
|---|---|---|
| User export job | An export job, started in the dashboard or with the Management API | Profile fields you choose, in JSON (one user per line) or CSV |
| Password hash export | A support case, with your tenant name, a PGP public key and a signed acknowledgment form | Password hashes, and MFA secrets if you ask for them; Auth0 reviews each request |
For this tool you need only the first one. Ask for the JSON format, not CSV: Auth0’s CSV export cannot hold app_metadata or user_metadata as whole objects, and the JSON keeps them. Turn on the default fields, which follow Auth0’s normalized user profile: user_id, email, email_verified, given_name, family_name, name, nickname, username, blocked, identities, created_at, user_metadata and app_metadata.
The export job is not available on Auth0’s free plan, and Auth0 does not promise when a password hash export will be ready. Plan the user export early, and do not wait for the hash export: Keycloak cannot use it, as the next section explains.
Why passwords do not move
Auth0’s own documentation says database passwords are hashed with bcrypt. Keycloak verifies passwords with the hash providers it ships: Argon2, and PBKDF2 with SHA-512, SHA-256 or SHA-1. It has no bcrypt provider. A bcrypt hash imported as a Keycloak credential would not verify, and the user could not sign in with it.
Keycloak does let a developer add a hash provider of their own. RealmDeploy clusters run the stock Keycloak image with no custom providers, so that route is closed today. We are evaluating a bcrypt provider; until one exists on our clusters, Auth0 database users set a new password by email link after the move.
That is why the tool leaves every hash field out, even if your file has one. A hash that cannot be used is still sensitive data, and a file without it is safer to keep for a dry run.
Passwordless users (Auth0’s email and sms connections) have no password at all. The tool treats them like password users, so they get a set-password link, which works on every realm. If you would rather keep them passwordless, turn on passkeys in the realm and change their required action.
What the tool does with each field
| Auth0 field | Keycloak user | Notes |
|---|---|---|
email | email, in lower case | Also the username by default |
email_verified | emailVerified | Kept as it was |
given_name, family_name | firstName, lastName | From name when both are empty |
username | username when you choose the id | Falls back to user_id |
blocked | enabled: false | Or left out, if you choose |
created_at | createdTimestamp | Milliseconds since 1970 |
user_id | The auth0_user_id attribute | Useful to match records later |
app_metadata, user_metadata | User attributes | Nested objects become dotted names |
| The groups field you name | groups, as paths | Such as /staff/support |
identities | Who sets a password, who re-links | Not written to the file |
Fields with no place in Keycloak are listed in the result under “Read but not carried over”: identities, any password hash fields, mfa_factors, and sign-in history such as last_login and logins_count.
Password users and provider users
Each Auth0 user has one or more identities. An identity with the auth0 provider is a database user with a password. An identity with a provider such as google-oauth2, github or samlp is a social or enterprise sign-in.
A user with a database identity gets the UPDATE_PASSWORD required action. A user with only provider identities does not: they keep signing in with Google or their company’s identity provider, once you set that provider up in Keycloak. On the first sign-in, Keycloak’s first broker login flow finds the existing account with the same email and asks the user to confirm the link, by email or by signing in. The summary counts both kinds.
Groups and roles
Auth0 has no groups in the user profile. Teams often keep them in app_metadata.groups or app_metadata.roles, or in Auth0’s Authorization Core roles, which the export does not include. Name the field your tenant uses. A list becomes group paths; a string with commas or semicolons works too.
Keep the field out of attributes, so a group does not also appear as an attribute: the tool does this for the field you name. If your apps read roles from tokens, map the groups to Keycloak roles in the realm, and add a mapper so the token carries them the way your apps expect.
The file the tool writes
{
"groups": [{ "name": "staff", "subGroups": [] }],
"users": [
{
"username": "[email protected]",
"email": "[email protected]",
"emailVerified": true,
"firstName": "Sample",
"lastName": "One",
"enabled": true,
"createdTimestamp": 1709370900000,
"attributes": {
"plan": ["pro"],
"locale": ["en-US"],
"auth0_user_id": ["auth0|sample001"]
},
"groups": ["/staff"],
"requiredActions": ["UPDATE_PASSWORD"]
}
]
}Partial import adds the users, and the groups they belong to, to an existing realm. The realm import file adds a realm name and suits a new realm started with --import-realm. Both are the format Keycloak’s own export uses.
The page shows the first 20 users as a preview. The saved file has every user, so a large export does not slow the page down.
Before you import
- Declare the attributes in the realm’s user profile (Realm settings, User profile). Keycloak drops attributes it does not know, unless unmanaged attributes are enabled.
- Set up the realm’s SMTP connection, so the set-password emails can go out.
- Create the identity providers your social users need, with the same alias you will register at Google or the other provider.
- Import into a staging realm first, and compare counts with the summary.
- Sign in as a social test user and as a password test user, end to end.
After the import into production, send the set-password emails. In the admin console that is a user’s Credentials tab, Credential reset, Update Password, Send email. For many users, the admin REST API’s execute-actions-email endpoint does the same, with a link lifetime you choose. The migration email templates help you tell users first.
kcadm.sh update users/<user-id>/execute-actions-email \
-r <realm> -n -b '["UPDATE_PASSWORD"]' -q lifespan=86400Mistakes to avoid
- Importing a bcrypt hash as a Keycloak credential. It will not verify, and users will see a wrong-password error instead of a set-password link.
- Using
user_idas the username without thinking. Auth0 ids contain a|, which the tool turns into a dash; the email address is usually the better username. - Forgetting duplicate emails. Auth0 can hold the same email in two connections. Keycloak realms usually refuse that, so the tool keeps the first and lists the rest.
- Sending set-password emails before the realm’s SMTP and the email text are tested on staging.
- Keeping the export after the move. Delete every copy once you have signed off.
Where we come in
On Premium and Enterprise, our team does the move with you, using the plan’s 10 service hours a month: we convert, import into a staging copy, and help you test. On Starter you use these tools and the guides, and we answer questions in writing. A very large move is scoped as a Custom plan through the contact form. The readiness checklist lists every step for an Auth0 move.