Jump to content
McKay Development

Recommended Posts

Posted (edited)

Hello,

I have some bots that I created for fun, which run on node.js code as well as ASF.

My problem is that everytime my server restarts, ASF and the node.js scripts try to login at the same time, which gives me some "code expired" error, because the same 2fa code is used twice by ASF and my node.js script.

Right now, when that happens, it prompts me for "2fa login code" in the script window. Is there any way to skip that prompt, and "force" 2fa to retry 30 seconds later if the code is expired or gives any kind of error ?

I've already tried some stuff out, which didn't work at all, which is why I came here to ask for some help.

 

Here is the basic code I use for login :

const logOnOptions = {
  accountName: config.username,
  password: config.password,
  twoFactorCode: SteamTotp.generateAuthCode(config.sharedSecret),
  rememberPassword: true
};


client.logOn(logOnOptions);
client.on('loggedOn', () => {
  console.log('succesfully logged on with version '+config.version+');
  client.setPersona(1); //"0": "Offline", "1": "Online", "2": "Busy", "3": "Away", "4": "Snooze", "5": "LookingToTrade", "6": "LookingToPlay"
  client.setUIMode(3);  //"None": 0, "BigPicture": 1, "Mobile": 2, "Web": 3
  client.gamesPlayed(config.customGamePlayed)
  if (config.debugMode == true) {
      console.log("DEBUG MODE IS ACTIVE !")
  }
});

 

Thanks for reading ! Hopefully there's a way to achieve what I want to do.

(People already advised me to just add some delay before my code starts so it doesn't "collide" with ASF : This solution is kinda useless, because this problem usually happens when there are steam downtimes, when every account is reconnecting at the end of the outage. so delay wouldn't work since script is already launched in that case)

Edited by R3v3rso
(fixed some very broken english)
Posted

Check out the steamGuard event. You will want to listen for this, and if lastCodeWrong is true, then wait 30 seconds before generating a new code (or manually specify an offset of at least 30 seconds, but not so much that the code is too far in the future).

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