I’m playing around with the Spotify API but whenever I try to run a POST
RequestAsync I get the error 401 Unauthorized
Code:
local http = game:GetService("HttpService")
local data = http:RequestAsync({
Url = "https://api.spotify.com/v1/me/player/next",
Method = "POST",
Headers = {
["Content-Type"] = "application/json",
["Authorization"] = "Bearer [token]",
},
Body = http:JSONEncode({
["Content-Length"] = 0
})
})
if data.Success then
print("Status code:", data.StatusCode, data.StatusMessage)
print("Response body:\n", data.Body)
else
print("The request failed:", data.StatusCode, data.StatusMessage)
end