TotallyNotABOT Posted April 15, 2017 Report Posted April 15, 2017 So, there's a problem I've had with my both that I can't really understand. I am not really looking for people to spoon feed me the code, just for someone with more experience to point it out to me. After I activated Steam Guard on my Phone. To authenticate my BOT I use the steam-totp module. What's even weirder is that the BOT logs in through node-steam-user without any problems, but has some problems when it needs to log in through node-community. Here's the exception I've been getting: Node-steam-user: authenticated. // node-steam-user works! Error: SteamGuardMobile // node-steamcommunity fails. at SteamCommunity.<anonymous> (C:\Users\Brian\node_modules\steamcommunity\index.js:141:14) at Request._callback (C:\Users\Brian\node_modules\steamcommunity\components\http.js:67:15) at Request.self.callback (C:\Users\Brian\node_modules\request\request.js:188:22) at emitTwo (events.js:106:13) at Request.emit (events.js:191:7) at Request.<anonymous> (C:\Users\Brian\node_modules\request\request.js:1171:10) at emitOne (events.js:96:13) at Request.emit (events.js:188:7) at IncomingMessage.<anonymous> (C:\Users\Brian\node_modules\request\request.js:1091:12) at IncomingMessage.g (events.js:291:16)And here you can see a simplified version of my BOT (not showing the entire code for obvious reasons) that tries just to authenticate. Even though node-steam-user authenticates without any problems, node-steamcommunity fails. var SteamUser = require('../index.js'); var client = new SteamUser(); var SteamCommunity = require('steamcommunity'); var community = new SteamCommunity(); var SteamTotp = require('steam-totp'); function getCode(shared_secret, callback) { SteamTotp.getTimeOffset(function (offset) { return callback(SteamTotp.getAuthCode(shared_secret, offset)); }) } getCode('shared-secret', function (code) { client.logOn({ "accountName": "username", "password": "password", "twoFactorCode": code.toString() }); community.login({ "accountName": "username", "password": "password", "twoFactorCode": code.toString() }, function (err){ if (err !== null) { console.log(err); } else {console.log("SteamCommunity - authenticated");} }); }); client.on('loggedOn', function(details) { client.setPersona(SteamUser.EPersonaState.Online); client.gamesPlayed("Test game!"); }); Quote
Dr. McKay Posted April 16, 2017 Report Posted April 16, 2017 You can't use the same 2FA code twice. That means that effectively you can't login twice within 30 seconds. That said, you don't have to. SteamUser will give you login cookies you can use with SteamCommunity. client.on('webSession', function(sessionID, cookies) { community.setCookies(cookies); }); TotallyNotABOT 1 Quote
TotallyNotABOT Posted April 16, 2017 Author Report Posted April 16, 2017 Thanks a lot! Didn't really know that you can't use the same 2FA code twice. Maybe you can write that in the documentation, so that some people wouldn't get confused. Really appreciate your work! Quote
Recommended Posts
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.