Auth0 Error Occurs When Updating Username: "change_username script does not exist"

Overview

An error occurs when attempting to update a user's username in Auth0 because the script is missing from the connection. Resolve this issue by verifying the connection details and adding the missing script via the Management API.

When attempting to update a user's username, the following error occurs:

 

change_username script does not exist

 

Applies To

  • Auth0
  • Management API
  • Custom Database Connections

Cause

The change_username script is missing from the connection.

Solution

How is the missing script added to the connection?

 

Verify the connection details, back up the existing configuration, and patch the connection to include the missing script by following these steps:

  1. Call the Get a connection endpoint to retrieve the connection details.
  2. Check the response body to verify if change_username exists under customScripts.

    Get a Connection  
  3. Back up the response body after retrieving the connection details and before making any updates.
  4. If the change_username script is missing, call the Update a connection endpoint to add the script.
  5. Add the following line to the Body section before clicking the Test Endpoint button to update the connection:
    "change_username": "function changeUsername(oldUsername, newUsername, verified, callback)

Get a Connection2

NOTE: When using the options parameter, Auth0 overrides the entire options object. To avoid partial data or other issues, ensure all parameters are present when using this option.

Recommended content

No recommended content found...