Migrate from Ory Kratos to Auth0
This guide covers moving users from Ory Kratos to Auth0: what carries over and what doesn’t, how their passwords and second factors are handled, and the commands to run. It sticks to what is specific to this pair. The export guide for Ory Kratos and the import guide for Auth0 cover each side in full, including a rehearsal with synthetic users.
What carries over
Section titled “What carries over”| Ory Kratos to Auth0 | |
|---|---|
| Passwords | Kept. Auth0 accepts bcrypt and Argon2. |
| Second factors | Not exported: users enroll again on Auth0. |
| User IDs | The Kratos identity UUID is kept as source_id, and Auth0 adds its connection prefix to it. |
The Ory Kratos export leaves behind:
- Every trait except
email,usernameandphone: names and custom traits, soprofileis empty - MFA (TOTP, recovery codes and WebAuthn)
- Social sign-in links
- Recovery addresses and timestamps
Before you start
Section titled “Before you start”- iamigrate installed (see Installation).
- A self-hosted instance whose Admin API you can reach, usually on port
4434. iamigrate calls it without credentials, so Ory Network projects aren’t supported yet. - Auth0. An Auth0 tenant (use a development tenant for the rehearsal), a database connection to import into, the MFA factors you intend to import enabled under Security → Multi-factor Auth, and Management API credentials. The import guide walks through it.
1. Export from Ory Kratos
Section titled “1. Export from Ory Kratos”export KRATOS_ADMIN_URL=http://127.0.0.1:4434
iamigrate export --source kratos --out ./export/Identities with no password hash are skipped and listed in manifest.json.
The export is a snapshot: users created, and passwords changed, after it aren’t in it, so plan a freeze or a final re-export before cutover. Check export/manifest.json for skipped_records, because the command exits with status 0 even when users are skipped, and for the per-algorithm counts.
2. Deal with passwords
Section titled “2. Deal with passwords”Users keep their password: Auth0 accepts every hash algorithm Ory Kratos stores.
| Hash in the export | Auth0 |
|---|---|
| bcrypt | Imported. A bcrypt hash with cost 10 goes into password_hash, any other into custom_password_hash. |
| Argon2 | Imported as custom_password_hash, from the full PHC string. |
Look at hash_algorithm_counts in manifest.json to see which of these your Ory Kratos users actually have.
Plan whether you’ll re-run the import before the first run. Without --upsert, cost-10 bcrypt hashes go into Auth0’s write-once password_hash field. If you expect to re-import the same users, pass --upsert on every run, so every hash goes into the updatable custom_password_hash (see the Auth0 import guide).
3. Fit the data to Auth0
Section titled “3. Fit the data to Auth0”- Email is required. Auth0’s bulk import needs an email, so a user without one isn’t sent and is reported as
TRANSLATION_ERROR. An identity that signs in with a username or a phone number alone has no email. - Metadata.
metadata_adminbecomesapp_metadataandmetadata_publicbecomesuser_metadata. Auth0 takesapp_metadataanduser_metadataas they are, andvalidatereports a top-levelapp_metadatakey Auth0 reserves, such asemailorblocked.
4. Validate against Auth0
Section titled “4. Validate against Auth0”Set the target in the scaffolded mapping, then check the export against what the target can import. validate makes no network calls:
iamigrate map --target auth0 --mapping ./export/mapping.yaml --connection-id con_XXXXXXXXXXXXXXXXiamigrate validate --in ./export/users.cmf.jsonl.gz \ --mapping ./export/mapping.yaml --target auth0Add --connection-config connection.json (a GET /connections/{id} response) to check usernames against the connection’s own rules.
Fix every reported problem at the source, or in the CMF records, and run it again until it comes back clean. Review mapping.yaml too: custom metadata keys are flagged under manual_steps for you to place, rather than guessed at.
5. Rehearse, then import
Section titled “5. Rehearse, then import”Do a rehearsal first. Follow the Auth0 import guide with a fixture that holds the same hash algorithms as your users, against a disposable target, and sign in as a few of the users (see Generate test fixtures).
For the real run, point iamigrate at Auth0:
export AUTH0_DOMAIN=your-tenant.us.auth0.comexport AUTH0_CLIENT_ID=... # a Machine-to-Machine application with the scopes the import guide listsexport AUTH0_CLIENT_SECRET=...Split off a small canary, import it, and check the result before you import the rest:
gunzip -c export/users.cmf.jsonl.gz | head -n 100 | gzip > export/canary.cmf.jsonl.gzgunzip -c export/users.cmf.jsonl.gz | tail -n +101 | gzip > export/rest.cmf.jsonl.gz
iamigrate import auth0 \ --in ./export/canary.cmf.jsonl.gz \ --mapping ./export/mapping.yaml \ --connection-id con_XXXXXXXXXXXXXXXX \ --report ./export/canary-report.jsonSign in as a few canary users, then import the rest:
iamigrate import auth0 \ --in ./export/rest.cmf.jsonl.gz \ --mapping ./export/mapping.yaml \ --connection-id con_XXXXXXXXXXXXXXXX \ --report ./export/rest-report.jsonThe command exits with status 0 even when users fail. Always read the reports: each failed user is listed under failed with a code, and the follow-up lists (requires_password_reset, requires_reenrollment and so on) say who needs to hear from you. The import guide explains each code.
6. Verify
Section titled “6. Verify”Reconcile the file with the live target. It reports users missing from it and drift in the fields it can read back:
iamigrate diff auth0 --in ./export/users.cmf.jsonl.gz --mapping ./export/mapping.yamlA user showing up doesn’t prove its password hash was translated correctly. Before the export, create a few test users in Ory Kratos with passwords you know, one for each hash algorithm in manifest.json, and sign in as each of them on Auth0 after the import: Authentication → Database → your connection → Try Connection in the Dashboard, or any application that has the connection enabled.
Auth0 builds the user_id as auth0|<source_id>, so the Kratos identity ID 3f2b9c1e-… becomes auth0|3f2b9c1e-…. If your applications reference users by the old ID, keep that mapping.
Cutover
Section titled “Cutover”- Freeze changes in Ory Kratos, re-export, and import the final file.
- Reconnect what the export doesn’t carry: social sign-in links, and whatever lived in traits other than
email,usernameandphone. Kratos has no organizations or roles of its own, but if you keep them elsewhere, Auth0 can take them from files you write (see Organizations, roles and groups). Then point every application at Auth0. - Tell users what to expect. Their passwords keep working, apart from any user the report lists under
requires_password_reset, who needs a reset. Second factors aren’t exported, so users enroll them again. - Clean up the rehearsal. Delete the rehearsal users from User Management → Users, or delete the connection and recreate it, before you import real ones. Users deleted any other way can linger in Auth0’s user store and cause
DUPLICATED_USERlater.
See also
Section titled “See also”- Export users from Ory Kratos
- Import users into Auth0
export,validateandmapreferencesimport auth0anddiff auth0mapping.yaml