Jump to content
McKay Development

302 on changin avatar


optimus
 Share

Recommended Posts

Bellow i have some code, i took the FormData: from your steamcommunity files and just changed the values to match mine. the headers are then the same as any other request i send to steam with the cookies of course taken directly from the browser (i copied and pasted the stesssionid to the formdata: one ) however i get a 302 im not sure why can you help?

 

var cookie = "//cookies pasted from browser"

var buffer = fs.readFileSync("./pfps/[object Object].jpg",{encoding:"base64"})

console.log(buffer)

 

request({

    url:"https://steamcommunity.com/actionFileUploaders/",

    method:"POST",

    headers:{

        'Connection': 'keep-alive',

        'Accept': 'application/json, text/plain,*/*',

        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36',

        "Accept-Encoding":"gzip, deflate, br",

        //'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', changed for miltipart formdata

        'Origin': 'https://steamcommunity.com',

        'Sec-Fetch-Site': 'same-origin',

        'Sec-Fetch-Mode': 'cors',

        'Sec-Fetch-Dest': 'empty',

        'Accept-Language': 'en-GB,en-US;q=0.9,en;q=0.8',

        "Content-Type":"multipart/form-data;",

        "Referer":`https://steamcommunity.com/profiles/id64/edit/avatar`,

        "Content-Length":buffer.length,

        'Cookie': cookie

    },

    formData: {

        "MAX_FILE_SIZE": buffer.length,

        "type": "player_avatar_image",

        "sId": `id64`,

        "sessionid": `sID`,

        "doSub": 1,

        "json": 1,

        "avatar": {

            "value": buffer,

            "options": {

                "filename": "avatar.jpg",

                "contentType": "image/jpeg"

            }

        }

    },

},function callback(error,response, body) {

    console.log(response.statusCode,body,);

    //console.log(body);

})

Link to comment
Share on other sites

3 hours ago, Dr. McKay said:

Get rid of {encoding:"base64"}. You don't want a base64 string, you want a Buffer.

just removed it and still get a 302 status i even changed the cookies witch consist of (sessionid,steamloginsecure,steammachineauth) i commented out content size header incase it was messing with something but still doesnt work. i can see that its a buffer after removing {encoding:"base64"} but still wont work :(

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...