I am using the following code to make a POST request to https://accounts.spotify.com/api/token in order to receive a refreshed access token although every time I've tried I get an Error 400 (Bad Request)
$.ajax({
url: 'https://accounts.spotify.com/api/token',
type: 'post',
Headers: {
'Authorization': 'Basic ' + btoa(ClientID ':' ClientSecret),
'Content-Type': 'application/x-www-form-urlencoded'},
body: {
grant_type: 'refreshtoken',
refresh_token: RefreshToken
},
json: true
});