Generate token in WebApi. Error: "Grant type 'client_credentials' not allowed for the client."

To get a management API v2 token you’ll need to use an authorized Non Interactive client. You can check a step by step tutorial on how to create it and authorize it here: Management API Access Tokens . Make sure to authorize it for the Auth0 Management API under the Non Interactive Clients tab in the APIs section of the dashboard, with the required scopes that you need for your Management API requests. (You can check the scopes under each request, in the management API documentation )

To use the Client Credentials grant
you have to set a Token Endpoint Auth
Method other than “none”.

On your Auth0 Dashboard make sure that the Non Interactive client you’re using has the Token Endpoint Authentication Method set to something other than “None”, most likely it should be Post.

Once that is done, you might need to enable the client credentials grant. To enable it, scroll down in the client settings page and click Show Advanced Settings. In the Grant Types tab, you’ll be able to enable the Client Credentials grant.

The request to get a Management API v2 token should then look like:

curl --request POST \
  --url 'https://{{YOUR_AUTH0_DOMAIN}}/oauth/token' \
  --header 'content-type: application/json' \
  --data '{ "grant_type" : "client_credentials", "client_id" : "{{NON_INTERACTIVE_CLIENT_ID}}" , "client_secret" : "{{NON_INTERACTIVE_CLIENT_SECRET}}" , "audience" : "https://{{YOUR_AUTH0_DOMAIN}}/api/v2/" }'
1 Like