Skip to content

Conversation

@wassimoo
Copy link

Related Issue or Design Document

Fixes the Auth0 export script and improves the migration guide documentation for better clarity.

Changes

Script Fixes (0-get-auth0-user-data.sh)

  • Added error handling and validation for environment variables.
  • Fixed connection_id string interpolation bug.
  • Improved polling logic with proper error states handling.
  • Better user feedback with clear success/error messages.

Documentation Improvements (auth0.mdx)

  • Restructured content into three clear phases:
    • Prepare Auth0 data.
    • Configure Ory project.
    • Import users to Ory.
  • Added prerequisites section with all requirements upfront.
  • Added tip box for finding project/workspace IDs.
  • Clarified file outputs: script creates AUTH0_USERDATA.json automatically.
  • Enhanced post-migration section with verification and testing steps.

Impact

  • Prevents silent script failures with proper error handling
  • Makes migration guide easier to follow with logical phase structure

Checklist

  • I have read the contributing guidelines and signed the CLA.
  • I have referenced an issue containing the design document if my change introduces a new feature.
  • I have read the security policy.
  • I confirm that this pull request does not address a security vulnerability.
    If this pull request addresses a security vulnerability,
    I confirm that I got approval (please contact [email protected]) from the maintainers to push the changes.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added the necessary documentation within the code base (if appropriate).

@CLAassistant
Copy link

CLAassistant commented Oct 27, 2025

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@vinckr vinckr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!
looks pretty good already, I would do a test of the script and left some comments on style.

I think the numbered list here don't add anything and in general would be better without.
there are 2 steps only anyway so its not that hard to navigate and just looks confusing in the ToC (see screenshot below).

So please remove the Phase X parts and numbered list in headings.

also in line with the style guide: "Avoid using symbols and special characters in headings."

Image

:shipit:

bash <(curl https://raw.githubusercontent.com/ory/docs/master/code-examples/migrate-to-ory/0-get-auth0-user-data.sh)
```

This script creates `AUTH0_USERDATA.json` in your current directory containing all exported user data.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This script creates `AUTH0_USERDATA.json` in your current directory containing all exported user data.
This script creates `AUTH0_USERDATA.json` in your current directory and contains all the exported user data.

- **Auth0 account** with admin access to export user data
- **Ory account** and CLI installed
{/* TODO: change this to refer to new migration guide (docs/migrate-to-ory/migrate/create-project.mdx) */}
- **Ory project** created - See [creating a project](index.mdx) for instructions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should link to here for create project: docs/migrate-to-ory/migrate/create-project

export them as part of the general export process. To get the password hashes and other password-related information, you must
[create an Auth0 support ticket](#create-auth0-support-ticket).

If you get your users' password hashes and import them to Ory, users can log in to their accounts using the same credentials they
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If you get your users' password hashes and import them to Ory, users can log in to their accounts using the same credentials they
- If you get your users' password hashes and import them to Ory, users can log in to their accounts using the same credentials they used before the migration. For more information, see [Bulk identity migration](../migrate-to-ory/migrate/migrate-strategies#bulk-identity-migration).

[create an Auth0 support ticket](#create-auth0-support-ticket).

If you get your users' password hashes and import them to Ory, users can log in to their accounts using the same credentials they
used before the migration. If you can't get users' password hashes, you can still import Auth0 user accounts to Ory and migrate
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
used before the migration. If you can't get users' password hashes, you can still import Auth0 user accounts to Ory and migrate
- If you can't get users' password hashes, you can still import Auth0 user accounts to Ory and migrate
them using a [Password migration hook](../kratos/manage-identities/25_import-user-accounts-identities.mdx). For more information, see [Graceful identity migration](../migrate-to-ory/migrate/migrate-strategies#graceful-identity-migration).


If you get your users' password hashes and import them to Ory, users can log in to their accounts using the same credentials they
used before the migration. If you can't get users' password hashes, you can still import Auth0 user accounts to Ory and migrate
them using a [Password migration hook](../kratos/manage-identities/25_import-user-accounts-identities.mdx).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
them using a [Password migration hook](../kratos/manage-identities/25_import-user-accounts-identities.mdx).


## Export password hashes
- Auth0 account with admin access to export user data
- Ory account and CLI installed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Ory account and CLI installed
- Ory account with an Ory project already created - See [creating a project](docs/migrate-to-ory/migrate/create-project.mdx) for instructions

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We repeat the Ory CLI tool below in the Required tools section.

### Create bulk user export

To create a [bulk user export](https://auth0.com/docs/manage-users/user-migration/bulk-user-exports), you need a Management API
Access Token and the ID of your connection. This data is used by the migration script you run to get the user data. You can
Copy link
Contributor

@unatasha8 unatasha8 Nov 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Access Token and the ID of your connection. This data is used by the migration script you run to get the user data. You can
Access Token and the ID of your connection. You will need this information to export the Auth0 user data, when you run the migration export script.


To create a [bulk user export](https://auth0.com/docs/manage-users/user-migration/bulk-user-exports), you need a Management API
Access Token and the ID of your connection. This data is used by the migration script you run to get the user data. You can
inspect the script
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
inspect the script
You can inspect the export script


### Create bulk user export

To create a [bulk user export](https://auth0.com/docs/manage-users/user-migration/bulk-user-exports), you need a Management API
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To create a [bulk user export](https://auth0.com/docs/manage-users/user-migration/bulk-user-exports), you need a Management API
To create a [bulk user export](https://auth0.com/docs/manage-users/user-migration/bulk-user-exports), you need the Management API

## Import users to Ory

To import your Auth0 users to Ory, you must create new users in Ory and associate them with the imported data.
### Configure environment variables
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### Configure environment variables
### Set environment variables

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to keep it consistent with previous section

- If you don't have password hashes from Auth0, create new users for the known email addresses and the associated data. In this
case, users must create new passwords when they log in to their accounts for the first time. To facilitate this, enable
[account recovery](../kratos/self-service/flows/account-recovery-password-reset).
Configure the migration script by exporting the necessary environment variables:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Configure the migration script by exporting the necessary environment variables:
Set necessary environment variables for the import script:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to keep it consistent with previous section

3. Go to **Authentication** and navigate to **Database**.
4. Click the connection for which you want to export user data and copy its ID.

#### Run export script
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#### Run export script
### Run export script

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Increasing the heading level to match "Run import script" later

- Auth0 account with admin access to export user data
- Ory account and CLI installed
- Ory project created - See [creating a project](docs/migrate-to-ory/migrate/create-project.mdx) for instructions
- Required tools:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a bullet for the migration scripts. For example: "Export
and import migration scripts."

When you export password hashes, none of the involved parties has access to users' plain text passwords.
1. [Prepare your Auth0 data](#prepare-your-auth0-data): Export user data and password hashes
2. [Configure your Ory project](#configure-your-ory-project): Set up identity schema for email authentication
3. [Import users to Ory](#import-users-to-ory): Run the migration script to create users in Ory
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
3. [Import users to Ory](#import-users-to-ory): Run the migration script to create users in Ory
3. [Import users to Ory](#import-users-to-ory): Run the migration import script to create users in Ory


#### Run export script

The script accounts for all possible metrics you can export in a bulk user export. The bulk user export is a compressed,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The script accounts for all possible metrics you can export in a bulk user export. The bulk user export is a compressed,
The export script accounts for all possible metrics you can export in a bulk user export. The bulk user export is a compressed,

export AUTH0_TOKEN="your_auth0_management_api_token"
```

2. Run the script:
Copy link
Contributor

@unatasha8 unatasha8 Nov 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
2. Run the script:
2. Run the export script:

bash <(curl https://raw.githubusercontent.com/ory/docs/master/code-examples/migrate-to-ory/0-get-auth0-user-data.sh)
```

This script creates `AUTH0_USERDATA.json` in your current directory and contains all the exported user data.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This script creates `AUTH0_USERDATA.json` in your current directory and contains all the exported user data.
This export script creates `AUTH0_USERDATA.json` in your current directory and contains all the exported user data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants