Jump to content
McKay Development

webSession


Hajagha

Recommended Posts

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! 😉

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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