Problem statement
We would like to migrate users from one connection to another connection. Both connections are Auth0 Database connections.
Let’s say we have 2 connections Connection A and Connection B.
- We started using Connection A for an application.
- We added a new application and also started using Connection A.
- Later we decided to use Connection B and any new users (of an organisation) are mapped to Connection B.
- Now we would like to copy a subset of users from Connection A to Connection B. Since these users might be using both applications.
Solution
The way user movements are performed between connections in Auth0 are by performing a bulk user export ( Bulk User Exports ) then a bulk user import (Bulk User Imports ). This method does not give the password hashes and it needs to be requested separately as we need to perform tenant admin verification (due to the sensitive nature of this data).
This is the general workflow you will need to follow:
- Perform a bulk user export from Connection A (The User Import / Export Extension is a useful tool to help with the imports/exports that we can recommend)
- Request a password hash export for Connection, a minimum of 2 tenant admins will need to be verified for this to be completed.
- Remove users from the export list created in step 1 and 2 that you do not want to migrate.
- Merge the users left in step 3 together for import ( the schema for user import can be viewed in the documentation here: Bulk User Import Database Schema and Examples)
- Perform the bulk user import