Before anyone says this question has been asked hundreds of times before, I know. I’ve checked every single post and none of them have helped my achieve what I wanted. Mostly because everyone is using Python and not JS and Node.
Simply, all I want to do is fetch the X-CSRF token. This is the code that does the job.
function getToken(){
http.request({
host: 'auth.roblox.com',
path: '/v1/logout',
method: 'POST',
headers: {
'Cookie': `.ROBLOSECURITY=${cookie}`,
}
}, (res) => {
let data = ''
res.on('data', (d) => {
data += d
})
res.on('end', () => {
console.log(res.headers)
console.log(data)
})
}).end()
};
Value for res.headers['x-crsf-token']
is undefined
and data response is {"errors":[{"code":0,"message":"Authorization has been denied for this request."}]}
Help is appreciated.