Hello
I’m Japanese. I’m contributing using the translation function.
Please permit clumsy English.
I give up a request in oauth/tokne using axios at present, I’m in trouble because the following error goes out.
error: "access_denied"
error_description: "Unauthorized"
Actual source cord
var options = {
method: 'POST',
url: 'https://MY_DOMAIN/oauth/token',
headers: {
'content-type': 'application/x-www-form-urlencoded'
},
data: {
grant_type: 'client_credentials',
client_id: 'MY_CLIENT_ID',
client_secret: 'MY_CLIENT_SECRET',
audience: 'https://MY_DOMAIN/api/v2/',
}
}
axios.request(options).then(function (response) {
console.log(response)
}).catch(function (error) {
console.error(error)
})
But, when a request is sent by the following curl command, a normal result is returning.
curl --request POST \
--url 'https://MY_DOMAIN/oauth/token' \
--header 'content-type: application/x-www-form-urlencoded' \
--data grant_type=client_credentials \
--data 'client_id=MY_CLIENT_ID' \
--data client_secret=MY_CLIENT_SECRET \
--data 'audience=https://MY_DOMAIN/api/v2/'
What is the cause? Please help!