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!");
});