How to authenticate when sending post requests

I’m trying to get the x-csrf-token but it keeps erroring when I try using a post request.

fetch('https://auth.roblox.com/v2/login', {

    method: 'POST',
    headers: {
        cookie: ".ROBLOSECURITY="+cookieToken
    }


})
  .then(response => response.json())
  .then(data => console.log(data));

image

It validates my token correctly when I use get requests, but it seems to not work with post requests. Anyone know what i’m doing wrong?

If you get this error, roblox will pass a x-csrf-token header in the response. In your request headers, include x-csrf-token: TokenGiven Did not read the post correctly

Make sure you grab the new x-csrf-token in the response everytime you get that error.

1 Like