DoctorMcKay / node-steam-client

API-compatible fork of node-steam's SteamClient
https://steamcommunity.com/groups/SteamRE/discussions/1/
MIT License
52 stars 19 forks source link

Incompatibility with node-steam's SteamUser #2

Closed luxalpa closed 8 years ago

luxalpa commented 8 years ago

According to the readme: It should be compatible with all node-steam handler modules.

The usage of node-steam's SteamUser causes a zlib error: incorrect header check.

Code:

"use strict";

let SteamClient = require("steam-client");
let Steam = require("steam");

let steamClient = new SteamClient.CMClient();

steamClient.on("error", (e) => {
    console.log(e);
});

steamClient.on('connected', (err) => {
    console.log("Connected.");
    let user = new Steam.SteamUser(steamClient);
    user.logOn({
        account_name: accName,
        password: accPassword
    });
});

steamClient.on('logOnResponse', () => {
    console.log("Logged in!");
});

steamClient.connect();

Output:

Connected.
zlib.js:544
      throw error;
      ^

Error: incorrect header check
    at Zlib._handle.onerror (zlib.js:370:17)
    at Gunzip.Zlib._processChunk (zlib.js:534:30)
    at zlibBufferSync (zlib.js:239:17)
    at Object.exports.gunzipSync (zlib.js:175:10)
    at CMClient.handlers.(anonymous function) (/home/smaug/www/scraper/node_modules/steam-client/lib/cm_client.js:373:18)
    at CMClient._netMsgReceived (/home/smaug/www/scraper/node_modules/steam-client/lib/cm_client.js:253:24)
    at emitOne (events.js:90:13)
    at TCPConnection.emit (events.js:182:7)
    at TCPConnection._readPacket (/home/smaug/www/scraper/node_modules/steam-client/lib/tcp_connection.js:73:7)
    at emitNone (events.js:80:13)
DoctorMcKay commented 8 years ago

Please call steamClient.logOn in place of user.logOn.

luxalpa commented 8 years ago

The problem with is, now it immediately closes the connection after opening it, so I can not use other modules that operate on the steamClient.

Output:

Connected.
Logged in!
[Error: Disconnected]
DoctorMcKay commented 8 years ago

Couple things.

  1. logOnResponse doesn't indicate that you're logged on. You should check the eresult property of the first object argument to see if you logged in successfully.
  2. You need to set steamID to a valid initial value (76561197960265728). I had forgotten about this, and the documentation incorrect stated that logOn did this for you. If you update to version 2.1.2, then you can use user.logOn and it should just work.
luxalpa commented 8 years ago

I tried a few things. First I updated to 2.1.2.

I checked eresult and indeed it gave me the value 5 which stands for invalid password. However, then I changed it back from steamClient.logOn to user.logOn and suddenly it works now! Yay!

So thanks for that! At least now there is a working version :D

DoctorMcKay commented 8 years ago

Sorry, I was slightly unclear. On any version, steamClient.logOn would work if you set steamClient.steamID to "76561197960265728" first. Version 2.1.2 makes user.logOn work.