How do I log in through Web API with python?

ROBLOX RANKING BOT

Hey there, I am currently making a discord bot which would allow me to manage a roblox group. For instance, it would rank people.

Nevertheless, I am having some issues with it.
I am relatively new to API programming in python, and, well, I am not really advanced I would say.

The main issue is that I have no idea of how to log in Roblox and bypass Fun Captcha. I mean, I have tried with .ROBLOSECURITY cookie, however as I have said, I am not familiar with API programming and python requests, so I was not able to implement this feature.

Here is the piece of code which gives me problems:

 elif message.content.startswith(prefix + "rbxshout"):
        with requests.Session() as session:
           loginApi = "https://groups.roblox.com/v1/groups/4141561/status"
           roblosecurity = "Cookie here"    
           dataToSend = {"message":message.content[len(prefix+"rbxshout"):]}
           cookieData = {".ROBLOSECURITY":roblosecurity}
           tokenN = "Token here"
           auth = {"X-CSRF-TOKEN":tokenN}
           data = session.patch(loginApi, data=dataToSend, headers=auth, cookies=cookieData)
           shout_message = discord.Embed(description="Successfully posted: %s" % message.content[len(prefix+"rbxshout"):],colour=0xff6961,title="New group shout")
           await message.channel.send(embed=shout_message)

I would be really grateful if someone gave me any idea on how to make it work.

PSA: Sorry if this isn’t the right category, I didn’t know where else to put it.

2 Likes

Hello,
I believe you can ask questions related to the web api of Roblox

But this post might help you

2 Likes

Hi,
I have already seen that post, and that is how I realized I had to use cookies, however after trying to log in an error pops up:

{‘errors’: [{‘code’: 0, ‘message’: ‘Token Validation Failed’}]}

Just pass a “.ROBLOSECURITY” cookie

1 Like

I had found a wrong CSFR token, now it works, thank you for your answers.

2 Likes

Good to hear that :slight_smile: