Problem statement
A custom API has been created in the Auth0 dashboard:
- the endpoint is in the Auth0 Management API
- the audience is the new custom audience
While updating the user_metadata, a “Bad Audience ” error is encountered. Accessing the Management API endpoint returns a 401 Unauthorized error.
Symptoms
Accessing Management API endpoint returns a 401 Unauthorized.
Troubleshooting
Capture this flow in a HAR file and analyze the result. For guidance on how to create a HAR file, refer to the following doc:
Solution
The endpoint that was attempted in the HAR file is an Auth0 Management V2 endpoint and requires a token audience to be set to the Auth0 Management API endpoint and for the scope “update:current_user_metadata” to be set.
The scopes required for the different endpoints can be found in the Management API v2 documentation. For further information check related references below.
Related References