Requests to an API with JavaScript not being authenticated

32 viewsjavascriptrequestroblox
0

What I’m trying to do is execute JavaScript code in my browser to send a GET request to the Roblox API https://economy.roblox.com/v1/user/currency to grab the Robux (In-game currency of the game Roblox) amount in my Roblox account. The problem is that when I have a tab of roblox.com open and I execute the JavaScript code to grab the Robux amount, the requests to the API will not be authenticated. (missing .ROBLOSECURITY session cookie in the request)

The thing is, having a tab of economy.roblox.com open will allow the requests to /v1/user/currency to be authenticated, but I need to be on the roblox.com site to do the task that I have. Is there any way to send authenticated requests to economy.roblox.com while being in roblox.com?

And no, I can’t just grab the .ROBLOSECURITY cookie of my account then manually include it in the JavaScript code to send it to the API, there’s a reason why I can’t do this.

One approach I had in mind was to make the JavaScript code redirect me or open a tab of economy.roblox.com for a split second to send the API request, then redirect back to the roblox.com url that I was in, but this didn’t work as normal browser behaviour stops the rest of the JavaScript code from executing if I was redirected to another url.