Signing up for Auth0 Application

Learn how to signup on the Auth0 application by using Auth0 API.

The signup endpoint in Auth0 is used to create a new user account. This endpoint allows clients to submit a request to register a new user, including the user's email address and password. The endpoint then validates the request, creates a new user account in the database, and returns the metadata of the created user.

Press + to interact
Signup endpoints
Signup endpoints

Signup endpoint

The signup endpoint of Auth0 enables users to create new accounts on an application. When a user submits the signup form, the API sends a request to the endpoint with the user’s information, such as name, email address, and password. The endpoint then validates the data and creates a new user account. In this section, we will use the https://{{DOMAIN}}/dbconnections/signup endpoint for signing up a user by sending a POST HTTPS request.

Request parameters

In order to invoke this endpoint, we will use a POST request. We have a list of parameters that can be passed as body parameters. Let's have a look at some important ones in the table below:

Parameter Name

Type

Category

Description

client_id

String

Required

Defines the client ID.

email

String

Required

Defines the user's email.

password

String

Required

Defines the user's password.

connection

String

Required

Defines the connection name used for the user.

username

String

Optional

Defines the username of the user.

name

String

Optional

Defines the name of the user.

Press + to interact
// Importing libraries here
const fetch = require('node-fetch');
const endpointUrl = new URL('https://{{DOMAIN}}/dbconnections/signup');
const headerParameters = {
'Content-Type': 'application/json',
'Authorization': 'Bearer {{ACCESS_TOKEN}}',
}
const bodyParameters = JSON.stringify({
"client_id": "{{CLIENT_ID}}",
"email": "sampleuser@example.com",
"password": "secret@123",
"connection": "{{CONNECTION_NAME}}",
"username": "SampleUser",
"name": "Sample User",
})
const options = {
method: 'POST',
headers: headerParameters,
body: bodyParameters,
};
async function signUp() {
try {
const response = await fetch(endpointUrl, options);
printResponse(response);
} catch (error) {
printError(error);
}
}
signUp();

Let's look at the highlighted lines from the code shown above:

  • Line 4: We define the endpoint URL for the API call.

  • Lines 11–18: We define the bodyParameters object.

    • Line 12: We define the client_id parameter and set it to the client's ID.

    • Lines 13–17: We define the rest of the required user details.

  • Line 28: We make a POST request using the fetch function.

  • Line 35: We invoke the signUp function.

Response fields

The successful execution of the above code will set up a signup of the user and return its details. Some of the important response fields are as follows:

Name

Description

_id

Contains the user ID of the user that we created.

email

Contains the user email that we created.

email_verified

Contains the user's email details, whether the email is verified or not with Auth0.

username

Contains the user's username.

Note: To use the user ID fetched by this endpoint in other endpoints, we have to add auth0| before it.