401 Unauthorized error with Spotify API

I’m playing around with the Spotify API but whenever I try to run a POST RequestAsync I get the error 401 Unauthorized

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)
	print("The request failed:", data.StatusCode, data.StatusMessage)

in this case i think you should use http:PostAsync() instead
more of it here : HttpService | Roblox Creator Documentation

This is so wrong. As I read about Spotify API, getting info from your current track, you should be using HttpService:GetAsync()

Here’s the link for more details about getting current playing track from Spotify.

1 Like

i honestly wouldnt know because i dont own a spotify account(or use) i just open a tab youtube then place it in the back