HTTP 401 when trying to get a user's following

I want to use roproxy to get a user’s followings. However, it errors with HTTP 401 (Unauthorized).

This is my code:

local function PrintFollowings(Player: Player)
        local headers = {
		["Cookie"] = ".ROBLOSECURITY=(my cookie)",
		["x-csrf-token"] = "(token)",
	}

	local Success, Result = pcall(function()
		local result = HttpService:GetAsync(
			"https://friends.roproxy.com/v1/users/" .. Player.UserId .. "/followings",
			false,
			headers
		)
		local json = HttpService:JSONDecode(result)
		return json
	end)

	if not Success then
		warn("Failed to fetch followings for", Player.UserId, Result)
		return
	end

	print(Result)
end

Am I doing anything wrong? Help would be much appreciated!

Have you tried via the official Roblox APIs rather than roproxy? It’s good to test on your own without a proxy in the middle.
You’d need to, of course, use another way (eg Axios on JavaScript) to fetch the HTTP result though.

Also, why are you using a cookie? Isn’t it safer to use an API key, which roproxy will also accept?
(roproxy is a proxy, so essentially it forwards everything to roblox. that means it should accept the same API keys Roblox does)

you’re confusing roproxy with roblox’s official opencloud

i dont think opencloud offers ability to check users followings though


A cookie is required in order to access the data, and I’m pretty sure Roblox blocked direct HTTP requests to roblox.com.

Oh, right, yeah.
I thought the Domains and OpenCloud endpoints were the same, since they were in the same section, lol!

Yeah, my bad. Mixed up OpenCloud and legacy domains.

I did some digging, and it seems a typical curl request would look like this (minus auth):

curl -X 'GET' \
  'https://friends.roblox.com/v1/users/7819606367/followings' \
  -H 'accept: application/json'

So… i’m not exactly sure what the ‘false’ is doing there in your request.

I did some random follower jumping to get a random user ID, and it indeed got their followings without a hassle on the official Roblox endpoint, so I don’t think it’s an issue there.

Maybe it could just be an issue with Roproxy? Try with another cookie on an alt, or another user, and see if that works.

false is there for GetAsync because its the default value. Its nocache = false on the documentation.

I switched to using rotunnel, still seems to be the same issue.

The cookie I put in is a brand new account’s cookie, I have also tried using different accounts, still the same result, HTTP 401

Ahh, alright, apologies.

Have you tried fetching different user IDs, by any chance? It could also just be an isolated error with that specific user ID.

Feel free to try mines, 104912389, and see how that goes.

image
Still doesn’t work, HTTP 401 again.

Ah, shame.
Let’s try and see if the issue is isolated to a specific experience, too, now.

We should try testing just the endpoint in another, blank game and see if that works. Do turn on HTTP access, of course.

If it works, that’s great, and the problem is your specific game.
If it doesn’t, then it could be a device thing, since studio is a bit different to live playtime, so we can test in a real game and see if it works.
(We can check using /console, and setting the logs to ‘Server’)

One question. Pretty stupid really if this was the problem, does the .ROBLOSECURITY cookie start with a _ ? ex. _LKSDJFlKEblsdF?

I’m honestly not sure. Let me google that.

There’s an article I found regarding cookies that could help:

Wow, so the problem was, the cookie I put in still had the _ in front of it, causing it to error HTTP 401. It works now. Thank you so much.

No problem at all, glad it worked. c:

BY THE WAY. For other people having the same problem, please know that the X-Csrf-Token will CHANGE. You will need to Fetch the X-Csrf-Token and use the fetched result to ensure that it doesn’t throw HTTP 401 error again.