Я пытаюсь получить токен доступа с помощью аутентификации приложения для своего приложения Podio.
В настоящее время мой код выглядит так:
const authUrl = 'https://podio.com/oauth/token';
const data= "grant_type=app&app_id="+appId+"&app_token="+appToken+"&client_id="+clientId+"&redirect_uri="+uri+"&client_secret="+clientSecret;
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("requestResponse").innerHTML = this.responseText;
}
};
xhttp.open("POST",authUrl, true);
xhttp.send(data);
Я получаю ошибку 400, что означает, что запрос неверный. Но я тестировал его с помощью Beeceptor, он работает и выглядит нормально. Я не уверен, что делаю не так ...