Token Validation Failed

  fetch(`https://trades.roblox.com/v1/trades/send`,{method:"POST",headers: { 'Content-Type': 'application/json',"X-CSRF-TOKEN":token,"cookie": ".ROBLOSECURITY="+a.token+";"},
           body:JSON.stringify(
             {
  "offers": [
    {
      "userId": a.userid,
      "userAssetIds": d,
      "robux": 0
    },
     {
      "userId": 1588507530,
      "userAssetIds": [targetsmall],
      "robux": 0
    }
  ]
}
           ) 
         })

above errors with this

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

I’m fetching my x-csrf-token like this

const rp = require('request-promise');
const $ = require('cheerio');

const url="https://roblox.com/"

rp(options).then(function(){

    })
    .catch(function(err) {
      
    token=err.response.headers["x-csrf-token"]
    });
setInterval(function(){
rp(options).then(function(){

    })
    .catch(function(err) {
    token=err.response.headers["x-csrf-token"]


    
    });
},40000)

my request body was this

{"offers":[{"userId":895445660,"userAssetIds":[3173930243],"robux":0},{"userId":1588507530,"userAssetIds":[42641644],"robux":0}]}

The token, as well as my cookie, is valid. Why is the api erroring with that?

This same code was working perfectly a few days ago

2 Likes

This has happened to me too, when using a similar use it was a discord bot, but after a few requests and sending messages it just stopped, could this be connected?