Create Auth0 Applications with a Specific Client ID

Overview

This article explains how to create applications with a specific client_id in an Auth0 tenant. It carifies whether it is possible to create an application with a specific client ID in an Auth0 tenant and addresses the scenario where the default behavior prevents custom ID assignment, resulting in a forbidden error.

 

{
  "statusCode": 403,
  "error": "Forbidden",
  "message": "This operation must be authorized by Auth0",
  "errorCode": "operation_not_supported"
}

 

Applies To
  • Auth0 Applications
  • Application Client IDs
Solution

To enable custom client IDs for the applications, please open a support ticket. Once this feature is active, include the client_id parameter in the application creation payload.

To create an application with a specific client ID, use the following API call:

curl -L 'https://[TENANT-NAME].[REGION].auth0.com/api/v2/clients' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer 🔒' \
-d '{"name":"Test App","client_id":"abcde"}'

The client ID must be at least five characters long. A client ID with fewer than five characters results in the following error:

{
  "statusCode": 400,
  "error": "Bad Request",
  "message": "Payload validation error: 'Object didn't pass validation for format client-id: 1234' on property client_id (The id of the client).",
  "errorCode": "invalid_body"
}

The client ID must be unique in the tenant. Attempting to set an existing client ID results in the following error:

{
  "statusCode": 400,
  "error": "Bad Request",
  "message": "A client with the ID abcde already exists",
  "errorCode": "invalid_body"
}

Recommended content

No recommended content found...