HTTPS Service doesn't work when getting data (HTTP 401)

So I’m trying to get the player’s shirts when they join a game using HTTPS service, the only problem is I get this error;
This is the script I Used;

local http = game:GetService("HttpService")

	local SHIRTS = {}
	local AssetId = 11
	local baseUrl = "" .. AssetId .. "&cursor=&itemsPerPage=100&pageNumber=%x&sortOrder=Desc&userId="
	local plrUrl = baseUrl ..plr.UserId
	local data = http:GetAsync(plrUrl, true)
	local readableData = http:JSONDecode(data)
	for i, s in pairs(readableData["Data"]["Items"]) do
		table.insert(SHIRTS, s["Item"]["AssetId"])

I assumed I might need to change the link, so I tried changing the baseUrl from a robloxdevforumproxy link to a roproxy link:


but I then get this when i try to print the data table saying user doesn’t exist;

I’ve tried searching for a solution to this on the dev forum, I still get the same results.
so what do you guys think?

The visibility of a user’s inventory on roblox depends on their privacy settings. For this you need to provide an authentication cookie to the API so that it can check whether or not you are allowed to view that user’s inventory. You will basically need to get a bot account’s .ROBLOSECURITY cookie and then add an header to the request named Cookie with the value of .ROBLOSECURITY=cookie value here.

It is NOT reccomended to pass authentication credentials to a proxy that you do not have control over.

1 Like

if readableData.Data.Items then --perform this conditional check before the iteration
readableData.Data in your example is a string value (any attempt to index it will retrieve ‘nil’).

So I realized I had to make my own Roblox proxy for this to work, I did and now it works fine. Thanks for the response anyways!

1 Like