Jump to content


Photo
Question

Using loginKey gives Error: InvalidPassword

node.js node-steam-user

Best Answer Lenny McLennington , 20 April 2019 - 10:33 AM

I have tried what you said, it didn't work for that Steam account.

 

However, I tried with another Steam account and it did work. So it's just Steam.

 

Thank you.

Go to the full post


  • Please log in to reply
2 replies to this topic

#1 Lenny McLennington

Lenny McLennington

    Newbie

  • Member
  • Pip
  • 2 posts

Posted 19 April 2019 - 04:21 PM

I am writing the previous username used with the loginKey to a json file.

steamUser.on("loginKey", key => {
  var loginInfo =
  {
    accountName: userInfo.accountName,
    loginKey: key
  };
  var json = JSON.stringify(loginInfo);
  fs.writeFile("./login.json", json, "utf8", err =>
  {
    if (err) {
      console.error(err);
    }
  });
});

userInfo is an object containing accountName and rememberPassword which the user enters on startup.

 

This is the contents of the file "login.json" (Obviously I haven't included the username and loginKey in this post but they are there in the real thing)

{"accountName":"","loginKey":""}

I then load this file and use it with the logOn function:

var SteamUser = require("steam-user");
var steamUser = new SteamUser();

...

var prevLogin = require("login.json");
prevLogin["rememberPassword"] = true;
steamUser.logOn(prevLogin);

Then I get this error:

{ Error: InvalidPassword
    at SteamUser.<anonymous> (/home/lenny/expanddong/steam-user-testing/node_modules/steam-user/components/logon.js:458:16)
    at handlers.forEach (/home/lenny/expanddong/steam-user-testing/node_modules/steam-user/components/classes/HandlerManager.js:37:12)
    at Array.forEach (<anonymous>)
    at HandlerManager.emit (/home/lenny/expanddong/steam-user-testing/node_modules/steam-user/components/classes/HandlerManager.js:36:12)
    at SteamUser._handleMessage (/home/lenny/expanddong/steam-user-testing/node_modules/steam-user/components/messages.js:532:24)
    at SteamUser._handleNetMessage (/home/lenny/expanddong/steam-user-testing/node_modules/steam-user/components/messages.js:467:7)
    at SteamUser.processMulti (/home/lenny/expanddong/steam-user-testing/node_modules/steam-user/components/messages.js:559:9)
    at SteamUser.<anonymous> (/home/lenny/expanddong/steam-user-testing/node_modules/steam-user/components/messages.js:553:16)
    at handlers.forEach (/home/lenny/expanddong/steam-user-testing/node_modules/steam-user/components/classes/HandlerManager.js:37:12)
    at Array.forEach (<anonymous>) eresult: 5 }

So clearly I am doing something wrong. Is there some sort of tutorial on the correct way to do it? Or can someone tell me if they spot a mistake?



#2 Dr. McKay

Dr. McKay

    Developer

  • Administrator
  • 2,140 posts

Posted 19 April 2019 - 05:11 PM

You probably want to use require("./login.json") and not just require("login.json").



#3 Lenny McLennington

Lenny McLennington

    Newbie

  • Member
  • Pip
  • 2 posts

Posted 20 April 2019 - 10:33 AM   Best Answer

I have tried what you said, it didn't work for that Steam account.

 

However, I tried with another Steam account and it did work. So it's just Steam.

 

Thank you.







Also tagged with one or more of these keywords: Question, node.js, node-steam-user

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users