Jump to content
McKay Development

Recommended Posts

Hey there,


I made a quick code to send a trade offer but the error i got is HTTP error 401 and i don't know how to fix it. 

The bot is not a limited account.

var offers = new TradeOfferManager({
    steam:        client,
    language:     "en",
    pollInterval: 10000,
    domain: 'localhost',
    cancelTime: 300000

var code = SteamTotp.generateAuthCode(config.shared_secret);

var login_details = {
  "accountName": config.username,
  "password": config.password,
  "twoFactorCode": code

community.login(login_details, function(err, sessionID, cookies, steamguard) {
    if (err) {
        console.log("Steam login fail: " + err.message);
    console.log("Logged into Steam");

    offers.setCookies(cookies, function(err) {
        if (err) {
            process.exit(1); // Fatal error since we couldn't get our API key

        console.log("Got API key: " + offers.apiKey);

     community.startConfirmationChecker(10000, config.identity_secret);

client.on('webSession', function (sessionID, cookies) {
    offers.setCookies(cookies, function (err){
        if (err) {
            console.log('Unable to set trade offer cookies: '+err);
        console.log("Trade offer cookies set. Got API Key: "+offers.apiKey);

var offer = offers.createOffer("xxx");
offer.addTheirItem({"appid": 753, "contextid": 6, "assetid": "1768042517"});
offer.send("", "xxx", function(err, status) {
    if (err) {
    } else {
        console.log("Offer #" + offer.id + " " + status);
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.

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.

  • Create New...