Hi
I’m new to auth0 and I’m getting an “unauthorized” error when calling the management api.
I’ve created a login/post login action which calls the management api using the pre generated code:
var axios = require("axios").default;
var options = {
method: 'POST',
url: 'https://xxxxx.eu.auth0.com/oauth/token',
headers: {'content-type': 'application/x-www-form-urlencoded'},
data: {
grant_type: 'client_credentials',
client_id: 'xxxxx',
client_secret: 'xxxxx',
audience: 'https://xxxxx.eu.auth0.com/api/v2/'
}
};
axios.request(options).then(function (response) {
console.log(response.data);
}).catch(function (error) {
console.error(error);
});
This gives me an HTTP 401 error.
My application is a SPA
Anyone knows why this happens?