Auth0 Home Blog Docs

Bad Audience when calling Management API v2


#1

Hey Auth0 Community,

I’m trying to integrate the Auth0 Management API v2 into my backend service and during my testing, I’m encountering the following error:

{
    "statusCode": 401,
    "error": "Unauthorized",
    "message": "Bad audience: <my API identifier>"
}

I’ve created a Custom API in the API section of the dashboard and set the API Identifier to something like api.example.com, and set up some scopes like create:user.

Next, I created a Machine to Machine Application with is authorized to use the Custom API I created above, and then I enabled all scopes available.

Once that is done, I got the access token on the Test tab for the Machine to Machine Application I just created, and set that in the Management API Explorer. I see the domain set to .au.auth0.com, and all the scopes I require enabled.

I then tried calling the Create User API within the API Explorer, resulting in the above response. From previous posts, it seems that accessing the Management API requires the audience of .auth0.com/api/v2/. However, I am unable to create a custom API with that as the identifier. It just says that the identifier is reserved.

Anyone knows how to solve this?


#2

2 posts were merged into an existing topic: Auth0 Management API missing from dashboard?


#3