Thank you that solved it. I feel like I tried this before based on previous comments but anyways this is the command that works:
HTTP.post("https://accounts.spotify.com/api/token",
[
"Authorization" => "Basic $refreshtoken",
"Accept" => "*/*",
"Content-Type" => "application/x-www-form-urlencoded"
],"grant_type=client_credentials")