Authenticating the User when using ROBLOX API

I’m attempting to authenticate the user when using the ROBLOX API, but I’ve hit my first road block with the use of https://trades.roblox.com/v1/trade/(tradeid)/accept.

I’m using python and I’m constantly getting Token Validation Failed, but I am using a cookie from my account and it is recent. I’m using requests module.
Here is what I have so far…

cookie = ' my cookie, no you don't get it. '
tradeid = input("Enter the trade ID: ")
theurl = 'https://trades.roblox.com/v1/trades/' + tradeid + '/accept'

r = requests.post(
    url=theurl,
    cookies={
        ".ROBLOSECURITY": cookie
    }

So, is there any reason I should be getting a token validation error, I’ve thought of using the x-csrf-token, but I feel that isn’t the problem, but maybe it is just shout some ideas!

That is the problem, you must have a valid X-CSRF-Token on most Roblox web APIs. Most of the time when you see the “Token Validation” error, you need to have the token. Just make sure you’re sending it in the headers.

Funny enough, after I made this thread I figured it out - after testing the header with the x-csrf-token it worked. Well, atleast someone will eventually search this up and find this thread.

1 Like

Hello!

Sorry for reviving this post but I’ve been stuck in this same issue for ages even though my XCRSF Token is correct I still receive this error? If possible are you able to provide a sample of your code that does the requesting part so I can see how you solved it?

Here’s how I did mine:

TradeRequest = request.post(URL, json=Offer, headers={'X-CSRF-TOKEN': XCRSFTOKEN, 'Content-Type': 'application/json'}, cookies={'.ROBLOSECURITY': ROBLOSECURITY})

Thanks, 50Alpha.