Move users from another provider
Import the users of an Auth0 export with the CLI, and read the paths for Clerk, Okta, Cognito and Firebase.
What it shows
- A dry run of
lumo migrate auth0reads the export file and checks each row. It sends nothing to LumoAuth. - A first import with
--limit 2creates two users, so that you can look at them before the rest. - The full import creates the other users. The users of step 2 exist, so the importer skips them. A row with no email address is skipped too.
- The script looks up the new LumoAuth ID for each Auth0
user_id, for the data that your app keeps under the old ID. It blocks the users that Auth0 had blocked.
The import is safe to run again: every row whose address exists is reported as skipped.
Before you start
- The export of your Auth0 users, in the JSON format. The recipe folder has a small fictional export,
auth0-users.json, in the same shape. Replace it with your own file. - An API key with the scopes
admin:users:readandadmin:users:write. Create it in the portal under Applications & developer tools, API keys. - The
lumoCLI andjq. See Install the CLI.
| Variable | Value |
|---|---|
LUMOAUTH_URL | The address of LumoAuth: https://app.lumoauth.dev, or https://eu.app.lumoauth.dev for the EU region. |
LUMOAUTH_ORG_ID | Your organization, for example acme-corp. |
LUMOAUTH_API_KEY | An API key with the scopes admin:users:read and admin:users:write. |
Code
Run each command from the recipes folder of the examples repository. Set the folder up once for your language. Every version below was run against a LumoAuth organization. The export file is a small fictional one, in the shape of the Auth0 users export: one JSON object for each line.
- lumo CLI
accounts/migrate-from-auth0/cli/migrate.sh
#!/bin/sh
# Import the users of an Auth0 export with the lumo CLI: check the file,
# import two users, import the rest, then map the old IDs to the new ones.
#
# sh accounts/migrate-from-auth0/cli/migrate.sh
#
# The script needs the lumo CLI and jq. The API key needs the scopes
# admin:users:read and admin:users:write.
set -eu
# The CLI reads its own three variables. With them it needs no `lumo login`.
export LUMO_BASE_URL="$LUMOAUTH_URL" LUMO_ORG="$LUMOAUTH_ORG_ID" LUMO_API_KEY="$LUMOAUTH_API_KEY"
# The export of the Auth0 users job, next to this folder: one JSON object
# for each line.
cd "$(dirname "$0")/.."
FILE=auth0-users.json
# One worker keeps the rows in the order of the file. The CLI prints the rows
# to stderr, and -o table leaves out the summary in JSON.
migrate() {
lumo migrate auth0 --file "$FILE" --concurrent 1 -o table "$@" 2>&1
}
# 1. Check the file. A dry run sends nothing to LumoAuth.
migrate --dry-run
# 2. Import the first two users, and look at the result before the rest.
migrate --limit 2
# 3. Import every user. The two users of step 2 exist and are skipped.
migrate
# 4. Map each Auth0 user_id to the new LumoAuth ID, for the data that your
# app keeps under the old ID. Block the users that Auth0 had blocked: the
# import does not carry that flag over.
echo "Auth0 user_id -> LumoAuth ID"
jq -r 'select(.email != null) | [.user_id, .email, (.blocked // false)] | @tsv' "$FILE" |
while IFS="$(printf '\t')" read -r auth0_id email blocked; do
id=$(lumo users get "$email" -o json | jq -r .data.id)
if [ "$blocked" = true ]; then
lumo users block "$id" -o json > /dev/null
echo " $auth0_id -> $id (blocked)"
else
echo " $auth0_id -> $id"
fi
done
accounts/migrate-from-auth0/auth0-users.json
{"user_id":"auth0|6650a1f0c2e4b0a1b2c3d401","email":"ada.lindqvist@northwind-shop.example.com","email_verified":true,"name":"Ada Lindqvist","given_name":"Ada","family_name":"Lindqvist","created_at":"2024-03-11T09:12:44.000Z","user_metadata":{"newsletter":true},"app_metadata":{"plan":"member"}}
{"user_id":"google-oauth2|104233817654321098765","email":"ben.carter@northwind-shop.example.com","email_verified":true,"name":"Ben Carter","given_name":"Ben","family_name":"Carter","picture":"https://example.com/avatars/ben.png","created_at":"2024-05-02T16:40:03.000Z"}
{"user_id":"auth0|6650a1f0c2e4b0a1b2c3d403","email":"chloe.ng@northwind-shop.example.com","email_verified":false,"name":"Chloe Ng","created_at":"2025-01-20T11:05:19.000Z"}
{"user_id":"auth0|6650a1f0c2e4b0a1b2c3d404","email":"dev.patel@northwind-shop.example.com","email_verified":true,"name":"Dev Patel","given_name":"Dev","family_name":"Patel","blocked":true,"created_at":"2023-11-30T08:22:51.000Z"}
{"user_id":"sms|6650a1f0c2e4b0a1b2c3d405","phone_number":"+15555550123","phone_verified":true,"created_at":"2025-06-14T19:47:30.000Z"}
sh accounts/migrate-from-auth0/cli/migrate.sh
Check the result
Output
→ Loaded 5 user(s) from auth0-users.json
--dry-run: no writes will be performed
Target tenant: acme-corp
Base URL: https://app.lumoauth.dev
Concurrency: 1
✓ ada.lindqvist@northwind-shop.example.com
✓ ben.carter@northwind-shop.example.com
✓ chloe.ng@northwind-shop.example.com
✓ dev.patel@northwind-shop.example.com
– (no email) (missing email)
Done. created=4 skipped=1 failed=0
→ Loaded 2 user(s) from auth0-users.json
Target tenant: acme-corp
Base URL: https://app.lumoauth.dev
Concurrency: 1
✓ ada.lindqvist@northwind-shop.example.com
✓ ben.carter@northwind-shop.example.com
Done. created=2 skipped=0 failed=0
→ Loaded 5 user(s) from auth0-users.json
Target tenant: acme-corp
Base URL: https://app.lumoauth.dev
Concurrency: 1
– ada.lindqvist@northwind-shop.example.com (already exists)
– ben.carter@northwind-shop.example.com (already exists)
✓ chloe.ng@northwind-shop.example.com
✓ dev.patel@northwind-shop.example.com
– (no email) (missing email)
Done. created=2 skipped=3 failed=0
Auth0 user_id -> LumoAuth ID
auth0|6650a1f0c2e4b0a1b2c3d401 -> 01a21fe5-63e5-7543-8953-ea2947960866
google-oauth2|104233817654321098765 -> 01a21fe5-6474-781e-87b2-6953a9a0d2ea
auth0|6650a1f0c2e4b0a1b2c3d403 -> 01a21fe5-66f6-7389-8ace-b5379944d9ca
auth0|6650a1f0c2e4b0a1b2c3d404 -> 01a21fe5-6791-733f-8d84-b75c6c167064 (blocked)
- The last part of the output has one line for each row of the export that has an email address. Four of the five rows have one, so four users exist in LumoAuth.
- In the portal, open Users. The four people are there, and Dev Patel has the state Blocked.
- Run the script again. Every row is now skipped, and the IDs of step 4 are the same.
- Open the sign-in page of your app and enter the address of an imported user. The page asks for a password and offers Forgot password?, which sends a link to set one.
Next: change your app
Change the sign-in of your app to LumoAuth, with a client ID of your organization. Auth0 client IDs and Auth0 tokens do not work at LumoAuth, so people sign in once again. Sign in through the hosted page shows the code.
Limits
- Passwords are not imported. The Admin API takes a password only as plain text and has no field for a hash from another system. Imported users sign in with a passwordless method that your organization offers, or set a password with Forgot password?. Add
--send-resetto the import to mail each new user a link for that. The link expires after 15 minutes. - The importer stores the email address, its verified state, the name and the username. It does not store
user_metadata,app_metadata,picture,localeor theblockedflag. Keep the metadata in your own database, under the new ID that step 4 prints. - Roles, groups, connections, Rules and Actions are not part of the users export. Recreate them in LumoAuth. The Auth0 migration guide lists what goes where.
- Second factors, passkeys and sessions do not move. People enroll their factors again.
- To try the import with real writes first, run it against a sandbox organization, which
lumo dev startcreates. See lumo dev. Check that your plan includes developer sandboxes in the plans matrix. - Clerk, Okta, Cognito and Firebase have no importer. Their guides show the same pattern by hand, with
jqandlumo users create: Clerk, Okta, Cognito and Firebase.