When I do:
curl -v -X "POST" -H "Authorization: Basic $refreshtoken" -d grant_type=client_credentials https://accounts.spotify.com/api/token
What is shown being requested is:
> Host: accounts.spotify.com
> user-agent: curl/7.74.0
> accept: */*
> authorization: Basic refreshtoken
> content-length: 29
> content-type: application/x-www-form-urlencoded
A few posts ago you tried adding content-type
but you for had converted the data to json, try adding content-type
to the headers. You might also try adding “user-agent” and “accept” to the headers as well. So:
HTTP.request("POST",
"https://accounts.spotify.com/api/token",
[
"authorization" => "Basic: $refreshtoken",
"user-agent" => "curl/7.74.0",
"accept" => "*/*",
"content-type" => "application/x-www-form-urlencoded"
],
"grant_type=client_credentials")