Hello
I’ve been trying my luck lately with Roblox API, this is the code i’ve got:
def getToken(robloxsecurity_token):
url = "https://auth.roblox.com/v2/logout"
headers = {
"Accept": "application/json",
"Cookie": ".ROBLOSECURITY="+ str(robloxsecurity_token)
}
r = requests.post(url, headers=headers)
return r
def setRole(robloxsecurity_token:str, group_id:str, user_id:str, role_id):
Authentification = getToken(robloxsecurity_token)
x_csrf_token = Authentification.headers["x-csrf-token"]
url = "https://groups.roblox.com/v1/groups/" + str(group_id) + "/users/" + str(user_id)
headers = {
"Content-Type": "application/json",
"X-CSRF-TOKEN": x_csrf_token,
}
cookies = {
"Content-Type": "application/json",
".ROBLOXSECURITY": ".ROBLOXSECURITY=" + str(robloxsecurity_token)
}
params = {
"roleId" : role_id
}
r = requests.patch(url, headers=headers, params=params, cookies=cookies)
return r
However, i’m always getting this error:
<Response [401]>
{'errors': [{'code': 0,
'message': 'Authorization has been denied for this request.'}]}
{'cache-control': 'no-cache', 'pragma': 'no-cache', 'content-length': '83', 'content-type': 'application/json', 'expires': '-1', 'x-frame-options': 'SAMEORIGIN', 'strict-transport-security': 'max-age=3600', 'roblox-machine-id': 'CHI1-WEB7894', 'p3p': 'CP="CAO DSP COR CURa ADMa DEVa OUR IND PHY ONL UNI COM NAV INT DEM PRE"', 'date': 'Tue, 24 May 2022 07:08:08 GMT', 'report-to': '{"group":"network-errors","max_age":604800,"endpoints":[{"url":"https://ncs.roblox.com/upload"}]}', 'nel': '{"report_to":"network-errors","max_age":604800,"success_fraction":0.001,"failure_fraction":1}'}
(b'{"errors":[{"code":0,"message":"Authorization has been denied for this reque'
b'st."}]}')
It’s been hard to find any proper python documentation, thanks in advance for your help