Jump to content
McKay Development

steam-totp generates invalid codes


 Share

Recommended Posts

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.

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...