var xhr = new XMLHttpRequest();
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.send(JSON.stringify({
client_id: 'CLIENT_ID',
client_secret: 'CLIENT_SECRET',
code: 'AUTH_CODE ',
grant_type: 'authorization_code'
}));
I tried with 'Content-Type': 'application/json' but still same result.
PS. In POSTMAN seems to be working fine for example.