
Okta
Octa
Introduction
One of the challenges when migrating an application's authentication infrastructure to Auth0 is migrating user information from the existing user database to Auth0.
Auth0 provides the following two user import functions, and this time we will introduce the procedure for "batch import".
- Batch import: Migration using a JSON file that defines user information
- Automatic migration: Automatically migrate user information from the existing user database when the user logs in via Auth0
In bulk import, define user information extracted from an existing user database etc. as a JSON file and import it to the user database in Auth0. Even if the existing user database stores a password using a hash algorithm compatible with Auth0, users can be migrated without requiring the user to reset their password.

premise
The operation examples on this page are for Auth0-linked web applications.
In addition, the information regarding functions and settings described on this page is current as of November 2022.
Setting overview
The user migration procedure by batch import is as follows.
Describe the user information to be registered according to the format specified by Auth0
- Importing with the Auth0 User Import/Export Extension
- Import via Auth0 Management API
Limitations
Auth0's bulk import can handle JSON files no larger than 500KB. If it exceeds 500KB, you need to split the JSON file.
https://auth0.com/docs/manage-users/user-migration/bulk-user-imports#create-users-json-file
Setting Example
Write the user information to be registered according to the format specified by Auth0.
Please check the URL below for field names such as email addresses and passwords, hash algorithms supported by Auth0, etc.
Custom password hash / Bulk User Import Database Schema and Examples - Auth0 docs
JSON file creation example (password: hashed by sha256, with salt)
[
{
"email": "test.user2@example.com",
"email_verified": true,
"blocked": false,
"custom_password_hash": {
"algorithm": "sha256",
"hash": {
"value": "fe956a8026cf49df7b507dde94e45408dca812f4fa63bbfd1a099b403110e832",
"encoding": "hex"
},
"salt": {
"value": "abc123",
"position": "prefix"
}
}
}
]
- Importing with the Auth0 User Import/Export Extension
![Auth0管理画面の[ Extensions ] > [ All Extensions ]から、[ User Import / Export ]をインストール](/business/security/okta/image/okta_auth0_umim_dr02.png)
![インストールした[ User Import / Export ]Extensionをクリックし、[ Please select a database connection ]でユーザの情報を格納するdatabase connectionを選択](/business/security/okta/image/okta_auth0_umim_dr03.png)
![インポート対象のJSONファイルを選択の上、[ START IMPORTING USERS ]をクリックしてインポートを開始](/business/security/okta/image/okta_auth0_umim_dr04.png)
![[ Import Status ]が[ Completed ]と表示され、インポートが完了したことを確認](/business/security/okta/image/okta_auth0_umim_dr05.png)
![[ Report ]をクリックし、インポートジョブの成功及びエラー発生有無を確認](/business/security/okta/image/okta_auth0_umim_dr06.png)

![Auth0管理画面の [ User Management ] > [ Users ]から、指定したdatabase connectionにインポートしたユーザが追加されたことを確認](/business/security/okta/image/okta_auth0_umim_dr08.png)
- Import via Auth0 Management API
There are various ways to execute the API, but the procedure described on this page is performed from the Auth0 Management API Explorer. As a preparation, the following two items are required.
- Acquiring an access token for the Auth0 Management API (Scopes: create; enable users)
Refer to the URL below for the procedure.
https://auth0.com/docs/secure/tokens/access-tokens/management-api-access-tokens - Apply access token on Auth0 Management API Explorer
Click [SET API TOKEN] and apply the acquired access token
![Auth0 Management API Explorer上で、[ Jobs ] > [ create import users job ]をクリック](/business/security/okta/image/okta_auth0_umim_dr09.png)
- users: Specify the JSON file to import
- connection_id: Specify the database connection ID of the import destination
- upsert: Specify "true" to update information for users that exist in the import destination database connection
- send_completion_email: Specify whether to send a completion email after the import job is completed
![各パラメータ値を入力し、[ Try ]をクリック](/business/security/okta/image/okta_auth0_umim_dr10.png)
![[ RESPONSE CODE ]が202と表示され、インポートが成功したことを確認](/business/security/okta/image/okta_auth0_umim_dr11.png)

![Auth0管理画面の [User Management ] > [ Users ]より、指定したdatabase connectionにインポートしたユーザが追加されたことを確認](/business/security/okta/image/okta_auth0_umim_dr13.png)
Supplementary matter
User import job submission and import job completion can also be confirmed from the Auth0 log.
- Import job submission log

- Import job completion log

Login confirmation example: Login with user information before migration


in conclusion
When migrating users using bulk import, you can easily import user data using a JSON file that defines user information, and if the hash algorithm is supported, there is no need to reset passwords when migrating users. This feature can also be used in the free Auth0 trial environment, so please try it out.
In addition to the bulk import introduced this time, Auth0 also provides a migration method called automatic migration. If you are interested in user migration achieved with Auth0, please contact us.
reference
Inquiry/Document request
In charge of Macnica Okta Co., Ltd.
- TEL:045-476-2010
- E-mail:okta@macnica.co.jp
Weekdays: 9:00-17:00