Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,7 @@ Changes the value of an [option](#options-).
- `twoFactorCode` - If you have a Steam Guard mobile two-factor authentication code, you can provide it here. You might not need to, see the [`steamGuard`](#steamguard) event. (Added in 1.9.0)
- `logonID` - A 32-bit integer to identify this login. The official Steam client derives this from your machine's private IP (it's the `obfuscated_private_ip` field in `CMsgClientLogOn`). If you try to logon twice to the same account from the same public IP with the same `logonID`, the first session will be kicked with reason `SteamUser.EResult.LogonSessionReplaced`. Defaults to `0` if not specified.
- As of v4.13.0, this can also be an IPv4 address as a string, in dotted-decimal notation (e.g. `"192.168.1.5"`)
- `machineId` - A Buffer containing the machine ID to use. If not specified, the machine ID will be generated automatically.
- `machineName` - A string containing the name of this machine that you want to report to Steam. This will be displayed on steamcommunity.com when you view your games list (when logged in).
- `clientOS` - A [number](https://github.com/DoctorMcKay/node-steam-user/blob/master/enums/EOSType.js) to identify your client OS. Auto-detected if you don't provide one.

Expand Down
8 changes: 8 additions & 0 deletions components/09-logon.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const PRIVATE_IP_OBFUSCATION_MASK = 0xbaadf00d;
* @property {string} [refreshToken]
* @property {string} [accountName]
* @property {string} [password]
* @property {string} [machineId]
* @property {string} [machineAuthToken]
* @property {string} [webLogonToken]
* @property {string|SteamID} [steamID]
Expand Down Expand Up @@ -79,6 +80,12 @@ class SteamUserLogon extends SteamUserMachineAuth {
}

let anonLogin = !details.accountName && !details.refreshToken;
let machineID = details.machineId || undefined;

if (machineID && !Buffer.isBuffer(machineID)) {
this._warn(`machineId must be a type of Buffer, but got '${typeof machineID}', it will be ignored and created internally.`);
machineID = undefined;
}

this._logOnDetails = {
account_name: details.accountName,
Expand All @@ -89,6 +96,7 @@ class SteamUserLogon extends SteamUserMachineAuth {
obfuscated_private_ip: {v4: logonId || 0},
protocol_version: PROTOCOL_VERSION,
supports_rate_limit_response: !anonLogin,
machine_id: machineID,
machine_name: !anonLogin ? (details.machineName || '') : '',
ping_ms_from_cell_search: !anonLogin ? 4 + Math.floor(Math.random() * 30) : 0, // fake ping value
client_language: !anonLogin ? 'english' : '',
Expand Down