Jump to content
McKay Development

Asking for steam guard code after few hours working


Recommended Posts

Hello guys. I've got a problem which i cant decide by myself..

First problem was that my bot was going offline with no reason, but i decided it

And now i got the second problem: After few hours (sometimes days) bot asking for steam guard code. In console it looks like: "Steam Guard Code:".

Guys, need your help :) Thanks.

ONWgHjy.png

Code: 

const config = require("./config.js");
const Config = require('config-js');
const SteamUser = require('steam-user');
const SteamTotp = require('steam-totp');
const SteamCommunity = require('steamcommunity');
const TradeofferManager = require('steam-tradeoffer-manager');
const client = new SteamUser();
const community = new SteamCommunity();
const manager = new TradeofferManager({
        steam: client,
        community: community,
        language: 'en' // Может быть любой язык
});

// Log in to account with config.js

const logOnOptions = {
    "accountName": config.steam.username,
    "password": config.steam.password,
    "twoFactorCode": SteamTotp.generateAuthCode(config.steam.twoFactorCode)
};

client.logOn(logOnOptions);

// After success login

client.on('loggedOn', () => {
        console.log('Bot succesfully authorized!');
    
        client.setPersona(SteamUser.Steam.EPersonaState.Online, config.steam.botname);
      

        console.log('Bot status changed to "Online"');
});

// Thats how i solve problem with going offline
community.on('sessionExpired', function(err) {
	if (err) {
		console.log('sessionExpired: '+err);
	}
	
	community.stopConfirmationChecker();
	
	
	if (client.steamID) {
		client.webLogOn();
	} else {
		client.logOn(logOnOptions);
	}
});

// Thats my way to solve second problem, but it didnt help.
client.on("steamGuard", function(domain, callback, lastCodeWrong) {
	if(lastCodeWrong) {
		console.log("Last code wrong, try again!");
		setTimeout(function() {
		    callback(SteamTotp.getAuthCode(config.steam.twoFactorCode));
		}, 30000);
	}	
});
Edited by Igaresha
Link to comment
Share on other sites

Correct me if I'm wrong, but isn't it should supposed to be like this?

community.on('sessionExpired', function(err) {
	if (err) {
		console.log('sessionExpired: '+err);
		client.webLogOn();
	}
	
	community.stopConfirmationChecker();
});

Also, another way to bypass Steam Guard Code is using loginKey

Edited by Vanilla
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...