Jump to content


Photo

Error: SteamGuardMobile

node.js node-steamcommunity

Best Answer Dr. McKay , 15 April 2017 - 08:41 PM

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);
});
Go to the full post


  • Please log in to reply
2 replies to this topic

#1 TotallyNotABOT

TotallyNotABOT

    Newbie

  • Member
  • Pip
  • 5 posts

Posted 15 April 2017 - 09:09 AM

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


#2 Dr. McKay

Dr. McKay

    Developer

  • Administrator
  • 1,413 posts

Posted 15 April 2017 - 08:41 PM   Best Answer

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 likes this

#3 TotallyNotABOT

TotallyNotABOT

    Newbie

  • Member
  • Pip
  • 5 posts

Posted 16 April 2017 - 02:55 AM

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! :)







Also tagged with one or more of these keywords: node.js, node-steamcommunity

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users