Auth0 HTTP 500 Error Occurs When Rotating Client Secret for Legacy or Global Clients
Last Updated:
Overview
When attempting to rotate the client secret of an application via the Auth0 Dashboard or Management API, the operation fails and Auth0 returns an HTTP 500 error. This error occurs for legacy or global clients because the JSON Web Token (JWT) configuration lacks initialization. Initialize the default configuration using a PATCH request to resolve the error.
HTTP 500 Internal Server Error
Applies To
- Auth0
- Tenant Global Clients (All Applications)
- Legacy applications created before 2016
- Secret rotation via Auth0 Dashboard or Management API
Cause
For certain legacy applications, the underlying JWT configuration is not initialized. When the secret rotation endpoint runs, Auth0 attempts to update a setting inside that configuration. Because the configuration is not initialized, the operation fails, and the API returns an HTTP 500 error.
Solution
What steps verify the uninitialized state?
Query the client details via the Management API to check whether the application lacks the initialized state.
- Send a GET request to the Management API.
curl --request GET \ --url 'https://<DOMAIN_NAME>/api/v2/clients/<CLIENT_ID>?fields=jwt_configuration' \ --header 'authorization: Bearer <NAME_MGMT_API_ACCESS_TOKEN>' - Review the response body. The response body omits
jwt_configurationor returns without the standard configuration fields when the application lacks initialization. The response contains a completejwt_configurationobject when the application is healthy.
Initialize the JWT configuration and rotate the client secret.
Send a PATCH request to the Management API to initialize the default configuration, confirm the initialization, and rotate the client secret.
- Send a PATCH request to the Management API for the affected client ID with
"jwt_configuration": nullto populate the default JWT configuration.
NOTE: Pass "jwt_configuration": null explicitly. Do not pass an empty object ({ "jwt_configuration": {} }). Passing an empty object leaves secret_encoded unset, whereas passing null populates all default fields properly.curl --request PATCH \ --url 'https://<DOMAIN_NAME>/api/v2/clients/<CLIENT_ID>' \ --header 'authorization: Bearer <NAME_MGMT_API_ACCESS_TOKEN>' \ --header 'content-type: application/json' \ --data '{ "jwt_configuration": null }' - Send a GET request to the Management API to confirm Auth0 populates jwt_configuration.
curl --request GET \ --url 'https://<DOMAIN_NAME>/api/v2/clients/<CLIENT_ID>?fields=jwt_configuration' \ --header 'authorization: Bearer <NAME_MGMT_API_ACCESS_TOKEN>' - Rotate the secret via the Auth0 Dashboard or by calling the rotation endpoint directly.
curl --request POST \ --url 'https://<DOMAIN_NAME>/api/v2/clients/<CLIENT_ID>/rotate-secret' \ --header 'authorization: Bearer <NAME_MGMT_API_ACCESS_TOKEN>'
How does the patch client option update the client secret?
As an alternative to the rotation endpoint, manually set a new client secret by sending a PATCH request to the Management API containing the new client secret in the data payload.
curl --request PATCH \
--url 'https://<DOMAIN_NAME>/api/v2/clients/<CLIENT_ID>' \
--header 'authorization: Bearer <NAME_MGMT_API_ACCESS_TOKEN>' \
--header 'content-type: application/json' \
--data '{
"client_secret": "<NEW_CLIENT_SECRET>"
}'