Roblox new way of getting x-csrf-token?

(python)
I used to retrieve the token by sending an api and getting getting the key “x-csrf-token” in the header…

however I found out that since 3-4 days ago, it gave me a keyerror when trying to get the token. So I decided to print the header and this is what I got

{'cache-control', 'content-type': 'application/json; charset=utf-8', 'server': 'Microsoft-IIS/8.5', 'x-aspnetmvc-version':, 'x-frame-options':', 'access-control-allow-credentials': , 'x-aspnet-version':, 'x-powered-by':, 'p3p':, 'date': 'Sun, 15 Nov 2020 13:21:40 GMT', 'content-length': , 'x-rblx-pop':'}

and I dont see the x-csrf-token here.

Can anybody help me?

Are you using logout endpoint?
It no longer returns csrf token.

1 Like

I was using the api

https://www.roblox.com/api/item.ashx?

it no longer seems to return csrf aswell…

Do you know any other api that returns the token or other way to obtain it?

I feel that endpoints that don’t need cookies no longer return csrf tokens

Do you have any idea how to obtain those in that case?

auth.roblox.com/v2/logout seems to succeed.

2 Likes

my current code

import requests

cookie='fakecookie'

print(requests.post("https://auth.roblox.com/v2/logout", headers={'Cookie':cookie}).headers['X-CSRF-TOKEN'])

keyerror


https://gyazo.com/6c15cebaff1318514405083fc67b8eff

I don’t think its need cookie, so try this:

import requests

print(requests.post("https://auth.roblox.com/v2/logout").headers['X-CSRF-TOKEN'])

Weird… doesn’t seem to work :cry:

I’ll leave this thread open for those wanting to contribute!

Whats the response code youre getting?

Its a keyerror the same as the console picture I posted earlier

Edit: I’ll check the response code tmrw(misread)

I just checked and I’m getting the response code of 401

I found problem, its need real cookie with .ROBLOSECURITY!

1 Like

Yeah it’s probably because your cookie only has the value string and not the key string .ROBLOSECURITY as well. If youre using headers instead of cookies in python requests, you have to include both in the string as KEY=VALUE

Works fine

I dont see what you mean by real ROBLESECURITY…
Can you share me your code(without your cookie)?

@dollychun Have you had time to look into this in meantime? :slight_smile:

Probably he means with “real ROBLOSECURITY” a valid Roblox cookie. My own experiments showed that a Roblox cookie has to be available in order to get a CSRF token in return.

1 Like

Guys for me this didn’t work I suggest you use the logout auth api as your not really logging in or out because your using a cookie, that api returns a x-csrf-token

You can also just use https://auth.roblox.com, it will give session and ip based csrf tokens