Jump to content
McKay Development

3top1a

Member
  • Posts

    1
  • Joined

  • Last visited

Posts posted by 3top1a

  1. Hi,
    I'm making a simple bot to just idle and serve as a secondary inventory, but for some reason, steam-totp is making invalid verification codes.
    Not like in nulls, but completely different codes from what SDA is saying (and yes, the SDA codes work, and the shared secret is the same).

    Code:

    const SteamUser = require('steam-user');
    const SteamCommunity = require('steamcommunity')
    const SteamTotp = require('steam-totp');
    const config = require('./config.json');
    
    console.log("BOTSTART")
    
    // On login - give steam our info, i.g. password, username
    var client = new SteamUser();
    var community = new SteamCommunity();
    
    client.logOn({
    	"accountName": config.username,
    	"password": config.password
    });
    
    client.on('steamGuard', function(domain, callback, lastCodeWrong) {
        console.log(domain)
        if (lastCodeWrong) {
            console.log("LAST2FACODEWRONG - last 2fA code was wrong.")
            // TODO Wait and then retry
            process.exit()
        } 
        console.log(SteamTotp.generateAuthCode(config.sharedSecret))
    	callback(SteamTotp.generateAuthCode(config.sharedSecret));
    });
    
    client.on('webSession', (sid, cookies) => {
    	manager.setCookies(cookies);
    	community.setCookies(cookies);
    	community.startConfirmationChecker(20000, config.identitySecret);
    });
    
    // After login - Basically main loop
    client.on('loggedOn', function(details) {
    	console.log("LOGIN " + client.steamID.getSteam3RenderedID() + " - Logged in");
    	client.setPersona(SteamUser.EPersonaState.Online); // Tell steam we're online
    	client.gamesPlayed(440); // Tell steam we're playing this game
    });
    
    // Debug stuff
    client.on('error', function(e) {
    	console.log("ERROR - " + e);
    });
    client.on('newItems', function(count) {
    	console.log("NEWINTEMS " + count + " - new items in our inventory");
    });
    client.on('wallet', function(hasWallet, currency, balance) {
    	console.log("WALLET " + SteamUser.formatCurrency(balance, currency) + " - Our wallet balance is ");
    });
    client.on('webSession', function(sessionID, cookies) {
    	console.log("WEBSESSIONACQ - We got a web session lol");
    });

    In the console, I'm getting:

    BOTSTART
    null
    * a code completely diffrent from SDA*
    null
    LAST2FACODEWRONG - last 2fA code was wrong.

    This is weird because an older version (that this is based on) worked flawlessly, all libraries are updated, and I still can't get this to work.

×
×
  • Create New...