Friends API - Error HTTP 403 (Token Validation Failed)

The endpoint you’re trying to use (/v1/user/following-exists ) requires an X-CSRF-Token and a .ROBLOSECURITY cookie. it’s an authenticated endpoint built for the roblox website not for game servers. the original get approach you had was correct the only problem was efficiency and you can easily solve that by paginating properly so instead of loadinag every single following at once you can fetch 100 at a time and stop the moment you find the target, most checks will resolve in a single request


function isFollowing(userId, targetId)
	local cursor = ""
	for page = 1, 50 do
		local url = "https://friends.roproxy.com/v1/users/" .. userId .. "/followings?limit=100&sortOrder=Desc" .. (cursor ~= "" and "&cursor=" .. HttpService:UrlEncode(cursor) or "")
		local ok, res = pcall(function() return HttpService:JSONDecode(HttpService:GetAsync(url)) end)
		if not ok then return false end
		for _, entry in ipairs(res.data) do if entry.id == targetId then return true end end
		cursor = res.nextPageCursor
		if not cursor or cursor == "" then break end
		task.wait(0.15)
	end
	return false
end

print(isFollowing(5355599125, 156) and "They are following!" or "Not following.")```
2 Likes