DoctorMcKay / node-steam-session

Node.js module for authenticating with the Steam auth server. Allows for generating refresh tokens and web auth cookies for use with steam-user and other packages.
https://www.npmjs.com/package/steam-session
MIT License
112 stars 20 forks source link

`startWithCredentials` throwing `InvalidParam` error #7

Closed osztenkurden closed 1 year ago

osztenkurden commented 1 year ago

I have long running script, that every hour uses steam-session to fetch some data, and between 7 hours ago and now startWithCredentials started throwing:

F:\Repositories\bakerytv\node_modules\steam-session\dist\helpers.js:17
    let err = new Error(errorMessage || resultMsg);
              ^

Error: InvalidParam
    at eresultError (F:\Repositories\bakerytv\node_modules\steam-session\dist\helpers.js:17:15)
    at AuthenticationClient.sendRequest (F:\Repositories\bakerytv\node_modules\steam-session\dist\AuthenticationClient.js:197:46)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async AuthenticationClient.startSessionWithCredentials (F:\Repositories\bakerytv\node_modules\steam-session\dist\AuthenticationClient.js:50:22)
    at async LoginSession.startWithCredentials (F:\Repositories\bakerytv\node_modules\steam-session\dist\LoginSession.js:130:38) {
  eresult: 8
}

Nothing was changed for weeks for now, tested on absolute minimum project, and error is still being thrown:

import { EAuthTokenPlatformType, LoginSession } from 'steam-session';
import fs from 'fs';
const session = new LoginSession(EAuthTokenPlatformType.SteamClient);

const machineToken = await fs.promises.readFile('./machinetoken').catch(() => null);

session.loginTimeout = 120_000;

const result = await session.startWithCredentials({
  accountName: 'ACCOUNT_NAME',
  password: 'ACCOUNT_PASSWORD',
  steamGuardMachineToken: machineToken,
  steamGuardCode: process.argv[2] || undefined
});

if(result.actionRequired){
  console.log("AUTH FAILED ACTION REQUIRED");
}
osztenkurden commented 1 year ago

In AuthenticationClient, method startSessionWithCredentials, commenting out device_details: deviceDetails makes it not crash, I'll investigate further. Edit: Removing platform_type from getDataForPlatformType in SteamClient in helpers also makes it not crash, but makes the rest unusable, as I need to be able to log in as Steam Client

akuma0 commented 1 year ago

Hi, I've work on a project based on this repo (really nice work by the way!) I generate the token for platform SteamClient, because WebBrowser platform didn't work (the email for the code is only send in SteamClient, not for WebBrowser, i don't know why...)
Since yesterday, between 11h15 and 17h49 it seems Valve make an update because now the api call to https://api.steampowered.com/IAuthenticationService/BeginAuthSessionViaCredentials/v1 still return a code 200 but with an empty body (content-length = 0) I don't know why, i've quickly check the login from the official website, it seems the protobuf didn't change. I will continue investigation by my side, if i have any update, i will post here.

DoctorMcKay commented 1 year ago

Acknowledged, I'll look into this asap. I suspect there might be a new parameter or something.

akuma0 commented 1 year ago

Could be relate to new protobuf properties : https://github.com/SteamDatabase/Protobufs/commit/8d7ea3e8f2eb2c07af410889aeaa572fded9c56a#diff-eebb3e8590a42dc9a60b141e2fde3e4109ecf5216ba2e2b786d8bdfde788757e Edit: I've update my protobuf, sending the new field (qos_level) with default value (2), still don't work. I have also notice something i didn't pay attention before, it's the rsa timestamp, it look really wierd : 140446250000 Maybe it's normal, maybe not...

DoctorMcKay commented 1 year ago

0.0.4 fixes this. To log in using the SteamClient platform type, it must now be done using a CM connection.

DoctorMcKay commented 1 year ago

I should note that I haven't tested 0.0.4 with a non-mobile-2FA account, so please let me know if it works or not if that applies to you.

osztenkurden commented 1 year ago

I can confirm that email based Steam Guard authentication works