Skip to main content
The Delete script implements the defined function to delete a specified user from an external database. We recommend naming this function deleteUser. The script is only used in a legacy authentication scenario, and is required if you want to delete a user from Auth0 and your external database in the same operation.

DeleteUser function

The deleteUser function should:
  • Remove the specified user from the external database.
  • Return a null value if the deletion succeeded.
  • Return an error if the deletion failed.

Definition

The deleteUser function accepts two parameters and returns a callback function:
This is a pseudo-JavaScript example of how you could implement the deleteUser function:

Callback function

The callback function accepts one parameter and returns a function.

Definition

Return a success

If the user was successfully deleted in your external database, return the callback function, and pass a null value for the error parameter:

Return an error

If an error occurs, return the callback function, and pass relevant error information to the error parameter:

Language-specific script examples

Auth0 provides sample scripts for use with the following languages/technologies: