Error 400 unsupported_grant_type on authentication

I’m trying to get an access token to be used in a web app. The code I’ve written gets back error 400 “unsupported_grant_type” and I’m not really sure how to fix it. The only fix I’ve found online is to set your content-type as urlencoded and I’ve already done that to no effect.

var request = new XMLHttpRequest();

request.open('POST', 'https://online-go.com/oauth2/token/');

request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

request.onreadystatechange = function () {
    if (this.readyState === 4) {
        console.log('Status:', this.status);
        console.log('Headers:', this.getAllResponseHeaders());
        console.log('Body:', this.responseText);
    }
};

var body = `
    client_id=___&
    client_secret=___&
    grant_type=password&
    username=___&
    password=___
`

request.send(body);