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
ThedeleteUser
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
ThedeleteUser
function accepts two parameters and returns a callback
function:
Parameter | Type | Description |
---|---|---|
id | String | User’s identity user_id . Does not start with auth0 . |
callback | Function | Used to pass error or profile data through the pipeline. |
Example
This is a pseudo-JavaScript example of how you could implement thedeleteUser
function. For language-specific examples, read Language-specific script examples.
Callback function
Thecallback
function accepts one parameter and returns a function.
Definition
Parameter | Type | Required | Description |
---|---|---|---|
error | Object | Required | Contains error data. |
Return a success
If the user was successfully deleted in your external database, return thecallback
function, and pass a null
value for the error
parameter.
Example
Return an error
If an error occurs, return thecallback
function, and pass relevant error information to the error
parameter.
Example
Language-specific script examples
Auth0 provides sample scripts for use with the following languages/technologies:- JavaScript
- ASP.NET Membership Provider (MVC3 - Universal Providers)
- ASP.NET Membership Provider (MVC4 - Simple Membership)
- MongoDB
- MySQL
- PostgreSQL
- SQL Server
- Windows Azure SQL Database