Jump to content
McKay Development

Recommended Posts

Posted (edited)
steamcommunity : 3.47.0
steam  : 1.4.1
steam-user  : 5.0.1
steam-totp  : 2.1.2
steamid  : 2.0.0
steam-tradeoffer-manager  : 2.10.6
steam-trade  : 0.2.6
steamcommunity : 3.47.0
Edited by Hajagha
Posted
6 hours ago, accxak said:

logOnResponse not contain webapi_authenticate_user_nonce

Yes. The issue lies with the old version of steam-user. We used steam-client for the connection and then another module handled acquiring the session using webapi_authenticate_user_nonce from logOnResponse. It seems that Steam removed this parameter from the response overnight. The latest version of steam-user successfully connects and obtains the session.

I have rewritten the connection and will be reworking the rest of the code to adapt to it. Thanks to the Doctor for his hard work! 😉

Posted

Hello! Any chance that you are sharing the solution? My bot uses tons of old libs with I fixed from time to time (e.g., steam-web-api-key, steam-weblogon, and steam-tradeoffers) but I am unsure how to fix this issue because the whole flow is now broken.

Posted (edited)
18 hours ago, Panp858 said:

Any chance that you are sharing the solution?

Hi! We also had legacy code that used steam-weblogon, which was layered on top of steam-client. Replacing them with steam-user for session handling is quite simple. Here's a part of my code, hope this helps.

let WebSession = false

const SteamUser = require('steam-user');
const SteamTradeOffers = require('steam-tradeoffers');
const getSteamAPIKey = require('steam-web-api-key');
const SteamTotp = require('steam-totp');
const SteamCommunity = require('node-steamcommunity');

const community = new SteamCommunity(config.ip);
const offers = new SteamTradeOffers();
const steamUser = new SteamUser({ localAddress: config.ip })

SteamTotp.generateAuthCode(user.shared, (err, code, offset, latency) => {
    const details = {
        accountName: user.username,
        password: user.password,
        twoFactorCode: code
    };
    steamUser.logOn(details);
})

steamUser.on('loggedOn', function(details) {
    steamUser.setPersona(SteamUser.EPersonaState.Online)
});

steamUser.on('webSession', (sessionID, cookies) => {
    console.log('WEBSESSION STARTED')
    getSteamAPIKey({
        sessionID: sessionID,
        webCookie: cookies
    }, function (err, APIKey) {
        if (!APIKey) APIKey = config.apikey;
        const sessionData = {
            sessionID: sessionID,
            webCookie: cookies,
            APIKey: APIKey,
            localAddress: config.ip
        }
        offers.setup(sessionData)
        WebSession = true;
        startConfirmations(cookies)

    });
})

function startConfirmations (cookies) {
    community.setCookies(cookies)
    community.startConfirmationChecker(20000, user.identity)
}

steamUser.on('tradeOffers', function (count) {
    if (!count || !WebSession) return
    handleOffers();
});

The latest version of steam-user is being used, so I had to update npm and node to version 14.

Edited by accxak
Posted
community.login(params);

The login method via SteamCommunity no longer returns incorrect Cookies.
Trying to use it with manager.setCookies() will result in an error.

The solution is to use steam-user, as shown in the @accxak example above. This returns the full-fledged cookies. 😀

Posted (edited)

Thanks mate, that helped!

On 10/19/2023 at 11:45 AM, accxak said:

Hi! We also had legacy code that used steam-weblogon, which was layered on top of steam-client. Replacing them with steam-user for session handling is quite simple. Here's a part of my code, hope this helps.

let WebSession = false

const SteamUser = require('steam-user');
const SteamTradeOffers = require('steam-tradeoffers');
const getSteamAPIKey = require('steam-web-api-key');
const SteamTotp = require('steam-totp');
const SteamCommunity = require('node-steamcommunity');

const community = new SteamCommunity(config.ip);
const offers = new SteamTradeOffers();
const steamUser = new SteamUser({ localAddress: config.ip })

SteamTotp.generateAuthCode(user.shared, (err, code, offset, latency) => {
    const details = {
        accountName: user.username,
        password: user.password,
        twoFactorCode: code
    };
    steamUser.logOn(details);
})

steamUser.on('loggedOn', function(details) {
    steamUser.setPersona(SteamUser.EPersonaState.Online)
});

steamUser.on('webSession', (sessionID, cookies) => {
    console.log('WEBSESSION STARTED')
    getSteamAPIKey({
        sessionID: sessionID,
        webCookie: cookies
    }, function (err, APIKey) {
        if (!APIKey) APIKey = config.apikey;
        const sessionData = {
            sessionID: sessionID,
            webCookie: cookies,
            APIKey: APIKey,
            localAddress: config.ip
        }
        offers.setup(sessionData)
        WebSession = true;
        startConfirmations(cookies)

    });
})

function startConfirmations (cookies) {
    community.setCookies(cookies)
    community.startConfirmationChecker(20000, user.identity)
}

steamUser.on('tradeOffers', function (count) {
    if (!count || !WebSession) return
    handleOffers();
});

The latest version of steam-user is being used, so I had to update npm and node to version 14.

Edited by Panp858

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...
×
×
  • Create New...