Cannot use /api/v2/custom-domains: Insufficient scope

When trying to GET /api/v2/custom-domains I receive an error saying:

{“statusCode”:403,“error”:“Forbidden”,“message”:“Insufficient scope, expected any of: read:custom_domains”,“errorCode”:“insufficient_scope”}

The token I used for the above request is obtained by:

POST https://<MY-TENANT>
headers: {'Content-Type': 'application/json'}
body: {'grant_type': 'client_credentials',
       'client_id': '<APP-ID>',
       'client_secret': '<APP-SECRET>', 
       'audience': 'https://<MY-TENANT>'}

I have tried with each one of the applications of my tenant. It is run by a separate Python script.
But neither has obtained the required permission (read:custom_domains and write:custom_domains).

The tenant has custom domains enabled.

What shall I do? Any help warmly welcomed.

Many thanks and kind regards,
– Pascal

So I found the answer to my own question.

The way to do it is to use the “Auth0 Management API” application (which is of machine-to-machine kind), browse to its APIs settings, open the section for “Auth0 Management API”, and checkmark the wanted *:custom_domain permissions.

1 Like

Glad you have figured it out and thanks for sharing with the rest of community!