STEAM GROUP
St​eamRE St​eamRE
STEAM GROUP
St​eamRE St​eamRE
6
IN-GAME
59
ONLINE
Founded
April 23, 2015
Language
English
All Discussions > node-steam-user > Topic Details
Changing lib sources
Hi there. I'm trying to add autoconnect function to your module and use it in my project. I already added supporting property in SteamUser client with my "shared_secret". Now I change these string in logon.js:
if(this.options.promptSteamGuardCode) { var rl = require('readline').createInterface({ "input": process.stdin, "output": process.stdout }); rl.question('Steam Guard' + (!domain ? ' App' : '') + ' Code: ', function(code) { rl.close(); callback(code); }); }

to these:

var details = this.client._details; callback(SteamTotp.generateAuthCode(details.shared_secret));
to automaticly generate new 2FA code if last was wrong. But now I'm getting this eror:
crypto.js:87 this._handle.init(hmac, toBuf(key)); ^ TypeError: Not a buffer
I get correct 2FA code in callback also. Can you help me to fix it please?
Last edited by thesaintrandom; Feb 17, 2016 @ 6:30am
< >
Showing 1-8 of 8 comments
McKay Feb 17, 2016 @ 10:18am 
Don't edit the module directly, you're doing it wrong if you're doing that.

You can either use the steamGuard event, or pass the code directly to logOn as twoFactorCode.
thesaintrandom Feb 17, 2016 @ 10:24am 
Ok, I'm going to try use 'steamGuard event'. Thanks.
thesaintrandom Feb 17, 2016 @ 11:38am 
Ok. I got this code:
//First logOn with valid details client.logOn(details); //Logging OFF setTimeout(function(){ client.logOff(); }, 10000); //Handling event and relogOn witn new 2FA code client.on("disconnected", function(eresult){ details = { "accountName" : config.accountName, "password" : config.password, "twoFactorCode" : SteamTotp.generateAuthCode(config.shared_secret) }; client.logOn(details); }); client.on('steamGuard', function(domain, callback) { console.log("steamGuard"); var code = SteamTotp.generateAuthCode(config.shared_secret) callback(code); });

I don't see "steamGuard" message in console. Why this event doesn't emmit?
McKay Feb 17, 2016 @ 11:41am 
Using both twoFactorCode and the steamGuard event is redundant. If you provide twoFactorCode in logOn, then it'll just use that to logon and steamGuard won't be emitted as it isn't needed.
thesaintrandom Feb 17, 2016 @ 12:16pm 
Ok I removed "twoFactorCode" from details object and now bot can't login even at first time. Still don't see any messages from 'steamGuard' event. Should I do something with "_steamGuardPrompt"?
McKay Feb 17, 2016 @ 6:36pm 
If you want to use the steamGuard event, you need to disable the promptSteamGuardCode option. But really the best way to do it is to provide the code as twoFactorCode in details.
thesaintrandom Feb 18, 2016 @ 5:43am 
Originally posted by FP Dr. McKay:
But really the best way to do it is to provide the code as twoFactorCode in details.
Yeah, I understand this but I doubt that you don't clearly understand what I'm trying to do. I just want to make auto relogin every day and avoid situation when 2FA code is invalid because time when you created code and when steam receive it is different and code already changed. In this situation we can see question in console but I want to make auto relogin completely programmly, so I want to avoid this problem and send new 2FA code when it happens.

Anyway I tried to disable promptSteamGuardCode option but still don't see messages from 'steamGuard' event.
McKay Feb 18, 2016 @ 9:22am 
There is no need to relogin. The most you need to do is call webLogOn().
< >
Showing 1-8 of 8 comments
Per page: 1530 50

All Discussions > node-steam-user > Topic Details