Bad Request when requesting JWT for Auth0 Admin API

I am trying to receive a JWT token for the management API.

I copied the code directly from the management API UI that is provided.

     var client = new RestClient("https://dev-bqynboke.us.auth0.com/oauth/token");
            var request = new RestRequest("https://dev-bqynboke.us.auth0.com/oauth/token",Method.Post);
            request.AddHeader("content-type", "application/json");
            request.AddParameter("application/json", "{\"client_id\":\"zzzzzzzzz\",\"client_secret\":\"zzzzzzz\",\"audience\":\"https://dev-bqynboke.us.auth0.com/api/v2/\",\"grant_type\":\"client_credentials\"}", ParameterType.RequestBody);
            var response = await client.ExecuteAsync(request);

I keep getting a bad request response, and the content is Invalid Json.

Any thoughts?

Thank you,
Marty

Hi @martin.d.weel ,

Thank you for posting this topic on the Auth0 Community!

I don’t see any errors in your scripts. Could you please check if the application for the client_id and client_secrete has the Management API scope assigned?

Also, do you see any error if testing this POST request in Postman? I can check it if you could DM me the details of the body script. Thanks!