Search code examples
pythonpython-requestsroblox

Roblox API Returns 401 Unauthorized


Whenever I try to make a POST request to https://users.roblox.com/v1/description it always gave me an 401 Unauthorized

My code:

import requests
Security = '_'
Session  = requests.Session()
Response = requests.post('https://auth.roblox.com')
if Response.status_code == 403:
    DescriptionToken = Response.headers['x-csrf-token']
    DescriptionSession = requests.Session()
    DescriptionSession.cookies['Cookie'] = '.ROBLOSECURITY=' + Security
    DescriptionSession.headers['x-csrf-token'] = DescriptionToken
    DescriptionResponse = DescriptionSession.post('https://users.roblox.com/v1/description',{"description": "Test"})
    print(DescriptionResponse.content)

I tried making an csrf token header and an .ROBLOSECURITY cookie I expected it to be 200 status code or something like that. The result is saying I'm unauthorized.


Solution

  • cookies['Cookie'] is supposed to be cookies['.ROBLOSECURITY'], good sir.