Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fixed inconsistent machine id between logins #503

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -568,16 +568,16 @@ There are five ways to log onto Steam:
default to logging on anonymously. This is still current behavior, but logging on in this manner is now deprecated.
If you now call `logOn()` without providing a `refreshToken` or `accountName` and without specifying `anonymous: true`,
then steam-user will raise a warning and then log on anonymously.
- Individually using a refresh token **(recommended)**
- Individually using a refresh token and account name **(recommended)**
- These properties are required:
- `accountName`
- `refreshToken`
- These properties are optional:
- `steamID` - If provided, steam-user will check to make sure that the provided `refreshToken` matches this SteamID. If SteamIDs don't match, the app will crash.
- `logonID` - Defaults to 0 if not specified.
- `machineName` - Defaults to empty string if not specified.
- `clientOS` - Defaults to an auto-detected value if not specified.
- These properties must not be provided:
- `accountName`
- `password`
- `machineAuthToken`
- `webLogonToken`
Expand Down
9 changes: 4 additions & 5 deletions components/09-logon.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class SteamUserLogon extends SteamUserMachineAuth {
}
}

let anonLogin = !details.accountName && !details.refreshToken;
let anonLogin = !details.accountName && !details.password && !details.refreshToken;

this._logOnDetails = {
account_name: details.accountName,
Expand Down Expand Up @@ -122,7 +122,6 @@ class SteamUserLogon extends SteamUserMachineAuth {
if (details.refreshToken) {
// If logging in with a refresh token, we need to make sure that no conflicting properties are set
let disallowedProps = [
'account_name',
'password',
'auth_code',
'two_factor_code'
Expand Down Expand Up @@ -171,7 +170,7 @@ class SteamUserLogon extends SteamUserMachineAuth {
}
}

let anonLogin = !this._logOnDetails.account_name && !this._logOnDetails.access_token;
let anonLogin = !this._logOnDetails.account_name && !this._logOnDetails.password && !this._logOnDetails.access_token;
let explicitlyRequestedAnonLogin = details !== true && details.anonymous;
if (explicitlyRequestedAnonLogin && !anonLogin) {
this._warn('Anonymous logon was requested but account details were specified; logging into specified individual user account');
Expand Down Expand Up @@ -209,8 +208,8 @@ class SteamUserLogon extends SteamUserMachineAuth {
}
});

// Machine auth token (only necessary if logging on with account name and password)
if (!anonLogin && !this._machineAuthToken && this._logOnDetails.account_name) {
// Machine auth token (only necessary if logging on with account name and password && email-based Steam Guard)
if (!anonLogin && !this._machineAuthToken && this._logOnDetails.account_name && this._logOnDetails.password) {
let tokenContent = this._logOnDetails._machineAuthToken || await this._readFile(this._getMachineAuthFilename());
if (tokenContent) {
this._machineAuthToken = tokenContent.toString('utf8').trim();
Expand Down