Jump to content
McKay Development

Much time asking for Steam Guard App Code


laroz

Recommended Posts

You can only use a code once. Subsequent uses will be rejected. Codes change every 30 seconds.

 

In practice, this means that a second login within a 30-second interval will be rejected and ask for a new code.

But what can i do, if the bot ask for Steam Guard Code:? 

The Bot dont try again for his own... i must turn off and start again to fix it... 

Link to comment
Share on other sites

Alright. I'm not completely sure if this will help you out, but this is what I currently use and it works for me:

// Disables asking for Steam Guard Code
client.setOption("promptSteamGuardCode", false);

// Logs on
client.logOn({
	"accountName": config.username,
	"password": config.password
});

// If some error occured during logon. Closes the process
client.on("error", function (e) {
    console.log(e);
    process.exit(1);
});

// If last Steam Guard Code was wrong, here a new one is created
client.on("steamGuard", function(domain, callback, lastCodeWrong) {
	if(lastCodeWrong) {
		console.log("Last code wrong, try again!");
	}	
	callback(SteamTotp.generateAuthCode(config.sharedsecret));
});

You will need to use the Steam Desktop Authenticator for this! That can be found here https://github.com/Jessecar96/SteamDesktopAuthenticator

 

Furthermore you need Dr. McKay's node-steam-totp library as well to generate new Steam Guard Codes from the shared_secret.

Please do some reasearch about 'shared_secret' and 'identity_secret' and from then on you'll be alright!

Edited by Frost Byte
Link to comment
Share on other sites

You can only use a code once. Subsequent uses will be rejected. Codes change every 30 seconds.

 

In practice, this means that a second login within a 30-second interval will be rejected and ask for a new code.

 

@Dr. McKay

 

Alright, I just had this problem that the last Steam Guard code was wrong and it tried logging into Steam again like 5 times within 2 seconds. Of course this gave me the RateLimitExceeded error. Could I solve this by adding a setTimeOut before the callback? Basically something like this:

// If last Steam Guard Code was wrong, here a new one is created
client.on("steamGuard", function(domain, callback, lastCodeWrong) {
	if(lastCodeWrong) {
		logger.warn("Last code wrong, try again!");
	}
	logger.warn("Waiting 30 seconds for a new Steam Guard code");
	setTimeout(callback(SteamTotp.generateAuthCode(config.sharedsecret)), 30000);	
});
Link to comment
Share on other sites

Thanks, that worked once again really well! My code did indeed not work since the callback wasn't a function...

 

I tried to create my own method.

function getGuardCode() {
	return callback(SteamTotp.generateAuthCode(config.sharedsecret)); /* I even tried without return, but that didn't help either */
}
	
setTimeout(getGuardCode(), 30000);

But well that didn't work...

 

I know you don't give JavaScript classes, but why does it work when you only have

function() {
    callback(SteamTotp.generateAuthCode(config.sharedsecret));
}

Does this 'force' callback to become a function? Or is it like 'Hey, here is now a function. Just use it'?

Link to comment
Share on other sites

Thank you guys!

That is working

client.on("steamGuard", function(domain, callback, lastCodeWrong) {
	if(lastCodeWrong) {
		console.log("Last code wrong, try again!");
		setTimeout(function() {
		    callback(SteamTotp.getAuthCode("YOURCODE"));
		}, 30000);
	}	
});

I mean this 30 seconds is for Steam Codes, cause this time needs to wait for the new code right?

 

Than close it :) Working! :)

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