HTTP Get infinite yielding

I’m converting a Spotify to Roblox integration to work outside of Studio but I’m having problems with using Get requests on the Spotify API. Sending any Get request yields infinitely and never gets a response, but Put and Post requests both work fine. I only get a response if the OAuth token is wrong, which gives me 401 as it should.

This is what I’m using to send requests, Post and Put requests work fine with this.

local Body = ""
local res
	
if method == "GET" then Body = nil end 

local res = httpService:RequestAsync({
	Url = "https://api.spotify.com/v1/me/player/"..URL,
	Method = method,
	Headers = {
		["Accept"] = "application/json",
		["Authorization"] = "Bearer "..Token,
		["Content-Type"] = "application/json"
	},
	Body = Body,
})

--doesn't get to part if sending a Get request
print(res.StatusCode,res.Success,res.StatusMessage,res.Headers,res.Body)

I assume what’s happening is it’s yielding and waiting for a response, but it’s just not getting one. One thing I know for sure is that Spotify requires you to set the Body of your request to an EMPTY STRING for requests that don’t use it, which Roblox doesn’t allow you to do for Get requests, and now what I’m wondering is if it’s because of that? Is there any way around this? Thanks.

Did you go to Game Settings → Security and turn on AllowHTTPRequests?

ok so uh appearantly your Token variable is not valid (also, have u ever heard of :GetAsync)

dude, it literally returned a http code it’s obviously turned on

They know that, it was mentioned in the post:


RequestAsync provides the same functionality with more extendability

Tis true…guess I didn’t look at the message careful enough.

If I recall correctly, Roblox doesn’t properly support Bearer tokens due to special characters within the tokens (Roblox doesn’t allow “|” or “/” in headers), this may be the cause of your problem. I don’t believe there is any alternative to this other than having your own web-server to send the request with the working Bearer token.