Custom Database Scripts Are Ignored When "Import Users to Auth0" Is Enabled

Overview

When Auth0 processes a custom database connection with the Import Users to Auth0 feature enabled, Auth0 only executes the login and get user scripts. In the Auth0 Dashboard, Auth0 hides the tabs for "verify", "change password", and "create and delete" scripts when import_mode is enabled. However, if the Management API or Deploy Command Line Interface (CLI) deploys these scripts, Auth0 accepts the request without validation errors but does not execute the scripts.

Applies To

  • Auth0
  • Custom Database Connections
  • Management API
  • Deploy CLI

Solution

Why does Auth0 ignore custom database scripts when import mode is enabled?

When a custom database connection enables the Import Users to Auth0 toggle (import_mode), Auth0 migrates users to the Auth0 database upon their first successful login. Because Auth0 migrates the users, Auth0 only requires and executes the login and get_user scripts. Auth0 ignores all other custom database scripts during runtime.

 

Expected Behavior for Management API and Deploy CLI Updates

The Auth0 Dashboard hides the tabs for the verify, change password, create, and delete scripts. However, the Management API and Deploy CLI do not validate whether import mode is enabled before accepting script payloads. If a payload includes these additional scripts alongside "import_mode": true, Auth0 accepts the request and updates the connection. Despite a successful upload, Auth0 ignores these additional scripts during runtime.

 

Test the following example of a Management API request that successfully uploads a change email script while import mode is enabled.

curl --location --request PATCH 'https://<tenant-domain>/api/v2/connections/<connection_id>' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <access_token>' \
--data '{
  "options": {
    "enabledDatabaseCustomization":true,
    "enable_script_context":true,
    "custom_scripts": {
      "login": "function login(identifierValue, password, context, callback) { ... }",
      "get_user": "function getUser(identifierValue, context, callback) { ... }",
      "change_email": "function (email, newEmail, verified, callback) { ... }"
    },
    "import_mode": true
  }
}'

 

Recommended content

No recommended content found...