I’m trying to automate Management API Token generation and I’m getting the following error:
error: 'access_denied',
error_description: 'Client is not authorized to access "https://squid-adm.auth0.com/api/v2/". You might probably want to create a "client-grant" associated to this API. See: https://auth0.com/docs/api/v2#!/Client_Grants/post_client_grants'
Here is my request options:
method: 'POST',
url: 'https://MY DOMAIN/oauth/token',
headers: { 'content-type': 'application/json' },
body:
{
grant_type: 'client_credentials',
'client_id': 'MY CLIENT ID',
client_secret: 'MY CLIENT SECRET',
audience: 'https://MY DOMAIN/api/'
},
json: true };
When I try to request to /api/v2/client-grants it returns:
"statusCode": 401,
"error": "Unauthorized",
"message": "Missing authentication"
With header:
"WWW-Authenticate": "Bearer",
"Content-Type": "application/json; charset=utf-8",
"cache-control": "no-cache"
How can I fix this and automate Management Api token generation ?