Migrating Database users from one tenant to another tenant

Problem statement

What is the best way to migrate users from a Database from one tenant to a Database in another tenant? I tried using the “User Import / Export” extension however this failed with “completed (1 of 1 failed)” error and it did not give me any reason for the failure.

Secondly, I did not see a password hash in the output. I see that a password hash is in the import schema and I assume that this would be needed to retain the user’s password.

Symptoms

  • “Completed (1 of 1 failed)” Error.

Solution

Exporting and importing users is the best method currently available to migrate users from one tenant to another, however there are some caveats:

  1. Password hashes are not available via any of our APIs for security reasons, you would need to raise a support ticket requesting this: Export Data

  2. Users need to be imported in JSON format, however for performance reasons, users are exported from Auth0 tenants in NDJSON format, so you would need to convert the export as mentioned here: Bulk User Exports

If you do not want the users to have to go through a password reset flow when logging into the new tenant, you will need to include the password hash in the import file.

So if this is the case, you would need to:

  1. Open a support ticket to request a password hash export of your users; We would carry out some security checks before providing the file.

  2. This file would only include hashes and IDs however, for the rest of the profile data you would need to perform an export from your tenant

  3. Convert your user export from NDJSON format to JSON

  4. Merge the password hash export data with your user export JSON

  5. Import the JSON into the new tenant

1 Like