0

You need to make a post request to Steam from the extension site to buy an item from the marketplace, but when requested from a third-party site, Steam returns status code 400, I understand that the problem is in the referrer, which should lead from the Steam page, but to me you need to make a request from another site, how can you change the referrer, if at all possible, or maybe there is some other way? I use this in my chrome extension! Below is part of the request code, the request comes from a service worker that is not covered by the CORS policy:

var form = {
    sessionid: options,sessionid, //options.sessionid
    currency: 5,
    subtotal: options.price, //options.price
    fee: options.fee, //options.fee
    total: options.fee + options.price, //options.fee + options.price
    quantity: 1
};

const response = await fetch(`https://steamcommunity.com/market/buylisting/${options.listing_id}`,{
    method: "POST",
    credentials: "include",
    headers: { "content-type": "application/x-www-form-urlencoded; charset=UTF-8"},
    mode: "cors",
    body: new URLSearchParams(form).toString()
});
CandyB
  • 11
  • 1

0 Answers0