Jump to content
McKay Development

Lenny McLennington

Member
  • Posts

    2
  • Joined

  • Last visited

Posts posted by Lenny McLennington

  1. 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?

×
×
  • Create New...