Jump to content


Photo
Question

Asking for steam guard code after few hours working

node.js node-steam-tradeoffer-manager

Best Answer Dr. McKay , 09 February 2018 - 03:23 PM

If you want the steamGuard event to work, you need to set the promptSteamGuardCode option to false.

Go to the full post


  • Please log in to reply
2 replies to this topic

#1 Igaresha

Igaresha

    Newbie

  • Member
  • Pip
  • 3 posts

Posted 09 February 2018 - 06:26 AM

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, 09 February 2018 - 10:33 AM.


#2 Vanilla

Vanilla

    Advanced Member

  • Member
  • PipPipPip
  • 73 posts
  • LocationIndonesia

Posted 09 February 2018 - 08:00 AM

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, 09 February 2018 - 08:02 AM.

  • Igaresha and McMuffinDK like this

#3 Dr. McKay

Dr. McKay

    Developer

  • Administrator
  • 2,111 posts

Posted 09 February 2018 - 03:23 PM   Best Answer

If you want the steamGuard event to work, you need to set the promptSteamGuardCode option to false.


  • Igaresha likes this





Also tagged with one or more of these keywords: Question, node.js, node-steam-tradeoffer-manager

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users