steamcommunity 3.44.3 → 3.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/FUNDING.yml +2 -2
- package/.idea/inspectionProfiles/Project_Default.xml +10 -10
- package/README.md +23 -23
- package/classes/CConfirmation.js +35 -35
- package/classes/CMarketItem.js +189 -189
- package/classes/CMarketSearchResult.js +89 -89
- package/classes/CSteamGroup.js +155 -155
- package/components/chat.js +283 -283
- package/components/groups.js +732 -732
- package/components/helpers.js +68 -56
- package/components/inventoryhistory.js +188 -188
- package/components/twofactor.js +152 -159
- package/components/webapi.js +118 -57
- package/examples/disable_twofactor.js +81 -62
- package/examples/edit-group-announcement.js +118 -118
- package/examples/enable_twofactor.js +131 -112
- package/index.js +597 -589
- package/package.json +1 -1
package/components/twofactor.js
CHANGED
|
@@ -1,159 +1,152 @@
|
|
|
1
|
-
var SteamTotp = require('steam-totp');
|
|
2
|
-
var SteamCommunity = require('../index.js');
|
|
3
|
-
|
|
4
|
-
var ETwoFactorTokenType = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
SteamCommunity.prototype.enableTwoFactor = function(callback) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
this.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// success = true means it worked
|
|
156
|
-
callback(null);
|
|
157
|
-
}, "steamcommunity");
|
|
158
|
-
});
|
|
159
|
-
};
|
|
1
|
+
var SteamTotp = require('steam-totp');
|
|
2
|
+
var SteamCommunity = require('../index.js');
|
|
3
|
+
|
|
4
|
+
var ETwoFactorTokenType = {
|
|
5
|
+
None: 0, // No token-based two-factor authentication
|
|
6
|
+
ValveMobileApp: 1, // Tokens generated using Valve's special charset (5 digits, alphanumeric)
|
|
7
|
+
ThirdParty: 2 // Tokens generated using literally everyone else's standard charset (6 digits, numeric). This is disabled.
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
SteamCommunity.prototype.enableTwoFactor = function(callback) {
|
|
11
|
+
this._verifyMobileAccessToken();
|
|
12
|
+
|
|
13
|
+
if (!this.mobileAccessToken) {
|
|
14
|
+
callback(new Error('No mobile access token available. Provide one by calling setMobileAppAccessToken()'));
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
this.httpRequestPost({
|
|
19
|
+
uri: "https://api.steampowered.com/ITwoFactorService/AddAuthenticator/v1/?access_token=" + this.mobileAccessToken,
|
|
20
|
+
// TODO: Send this as protobuf to more closely mimic official app behavior
|
|
21
|
+
form: {
|
|
22
|
+
steamid: this.steamID.getSteamID64(),
|
|
23
|
+
authenticator_time: Math.floor(Date.now() / 1000),
|
|
24
|
+
authenticator_type: ETwoFactorTokenType.ValveMobileApp,
|
|
25
|
+
device_identifier: SteamTotp.getDeviceID(this.steamID),
|
|
26
|
+
sms_phone_id: '1'
|
|
27
|
+
},
|
|
28
|
+
json: true
|
|
29
|
+
}, (err, response, body) => {
|
|
30
|
+
if (err) {
|
|
31
|
+
callback(err);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (!body.response) {
|
|
36
|
+
callback(new Error('Malformed response'));
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (body.response.status != 1) {
|
|
41
|
+
var error = new Error('Error ' + body.response.status);
|
|
42
|
+
error.eresult = body.response.status;
|
|
43
|
+
callback(error);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
callback(null, body.response);
|
|
48
|
+
}, 'steamcommunity');
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
SteamCommunity.prototype.finalizeTwoFactor = function(secret, activationCode, callback) {
|
|
52
|
+
this._verifyMobileAccessToken();
|
|
53
|
+
|
|
54
|
+
if (!this.mobileAccessToken) {
|
|
55
|
+
callback(new Error('No mobile access token available. Provide one by calling setMobileAppAccessToken()'));
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
let attemptsLeft = 30;
|
|
60
|
+
let diff = 0;
|
|
61
|
+
|
|
62
|
+
let finalize = () => {
|
|
63
|
+
let code = SteamTotp.generateAuthCode(secret, diff);
|
|
64
|
+
|
|
65
|
+
this.httpRequestPost({
|
|
66
|
+
uri: 'https://api.steampowered.com/ITwoFactorService/FinalizeAddAuthenticator/v1/?access_token=' + this.mobileAccessToken,
|
|
67
|
+
form: {
|
|
68
|
+
steamid: this.steamID.getSteamID64(),
|
|
69
|
+
authenticator_code: code,
|
|
70
|
+
authenticator_time: Math.floor(Date.now() / 1000),
|
|
71
|
+
activation_code: activationCode
|
|
72
|
+
},
|
|
73
|
+
json: true
|
|
74
|
+
}, function(err, response, body) {
|
|
75
|
+
if (err) {
|
|
76
|
+
callback(err);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (!body.response) {
|
|
81
|
+
callback(new Error('Malformed response'));
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
body = body.response;
|
|
86
|
+
|
|
87
|
+
if (body.server_time) {
|
|
88
|
+
diff = body.server_time - Math.floor(Date.now() / 1000);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (body.status == 89) {
|
|
92
|
+
callback(new Error('Invalid activation code'));
|
|
93
|
+
} else if(body.want_more) {
|
|
94
|
+
attemptsLeft--;
|
|
95
|
+
diff += 30;
|
|
96
|
+
|
|
97
|
+
finalize();
|
|
98
|
+
} else if(!body.success) {
|
|
99
|
+
callback(new Error('Error ' + body.status));
|
|
100
|
+
} else {
|
|
101
|
+
callback(null);
|
|
102
|
+
}
|
|
103
|
+
}, 'steamcommunity');
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
SteamTotp.getTimeOffset(function(err, offset, latency) {
|
|
107
|
+
if (err) {
|
|
108
|
+
callback(err);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
diff = offset;
|
|
113
|
+
finalize();
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
SteamCommunity.prototype.disableTwoFactor = function(revocationCode, callback) {
|
|
118
|
+
this._verifyMobileAccessToken();
|
|
119
|
+
|
|
120
|
+
if (!this.mobileAccessToken) {
|
|
121
|
+
callback(new Error('No mobile access token available. Provide one by calling setMobileAppAccessToken()'));
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
this.httpRequestPost({
|
|
126
|
+
uri: 'https://api.steampowered.com/ITwoFactorService/RemoveAuthenticator/v1/?access_token=' + this.mobileAccessToken,
|
|
127
|
+
form: {
|
|
128
|
+
steamid: this.steamID.getSteamID64(),
|
|
129
|
+
revocation_code: revocationCode,
|
|
130
|
+
steamguard_scheme: 1
|
|
131
|
+
},
|
|
132
|
+
json: true
|
|
133
|
+
}, function(err, response, body) {
|
|
134
|
+
if (err) {
|
|
135
|
+
callback(err);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (!body.response) {
|
|
140
|
+
callback(new Error('Malformed response'));
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (!body.response.success) {
|
|
145
|
+
callback(new Error('Request failed'));
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// success = true means it worked
|
|
150
|
+
callback(null);
|
|
151
|
+
}, 'steamcommunity');
|
|
152
|
+
};
|
package/components/webapi.js
CHANGED
|
@@ -1,57 +1,118 @@
|
|
|
1
|
-
var SteamCommunity = require('../index.js');
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
1
|
+
var SteamCommunity = require('../index.js');
|
|
2
|
+
|
|
3
|
+
const Helpers = require('./helpers.js');
|
|
4
|
+
|
|
5
|
+
SteamCommunity.prototype.getWebApiKey = function(domain, callback) {
|
|
6
|
+
var self = this;
|
|
7
|
+
this.httpRequest({
|
|
8
|
+
"uri": "https://steamcommunity.com/dev/apikey?l=english",
|
|
9
|
+
"followRedirect": false
|
|
10
|
+
}, function(err, response, body) {
|
|
11
|
+
if (err) {
|
|
12
|
+
callback(err);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if(body.match(/<h2>Access Denied<\/h2>/)) {
|
|
17
|
+
return callback(new Error("Access Denied"));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if(body.match(/You must have a validated email address to create a Steam Web API key./)) {
|
|
21
|
+
return callback(new Error("You must have a validated email address to create a Steam Web API key."));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
var match = body.match(/<p>Key: ([0-9A-F]+)<\/p>/);
|
|
25
|
+
if(match) {
|
|
26
|
+
// We already have an API key registered
|
|
27
|
+
callback(null, match[1]);
|
|
28
|
+
} else {
|
|
29
|
+
// We need to register a new API key
|
|
30
|
+
self.httpRequestPost('https://steamcommunity.com/dev/registerkey?l=english', {
|
|
31
|
+
"form": {
|
|
32
|
+
"domain": domain,
|
|
33
|
+
"agreeToTerms": "agreed",
|
|
34
|
+
"sessionid": self.getSessionID(),
|
|
35
|
+
"Submit": "Register"
|
|
36
|
+
}
|
|
37
|
+
}, function(err, response, body) {
|
|
38
|
+
if (err) {
|
|
39
|
+
callback(err);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
self.getWebApiKey(domain, callback);
|
|
44
|
+
}, "steamcommunity");
|
|
45
|
+
}
|
|
46
|
+
}, "steamcommunity");
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @deprecated No longer works. Will be removed in a future release.
|
|
51
|
+
* @param {function} callback
|
|
52
|
+
*/
|
|
53
|
+
SteamCommunity.prototype.getWebApiOauthToken = function(callback) {
|
|
54
|
+
if (this.oAuthToken) {
|
|
55
|
+
return callback(null, this.oAuthToken);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
callback(new Error('This operation requires an OAuth token, which is no longer issued by Steam.'));
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Sets an access_token generated by steam-session using EAuthTokenPlatformType.MobileApp.
|
|
63
|
+
* Required for some operations such as 2FA enabling and disabling.
|
|
64
|
+
* This will throw an Error if the provided token is not valid, was not generated for the MobileApp platform, is expired,
|
|
65
|
+
* or does not belong to the logged-in user account.
|
|
66
|
+
*
|
|
67
|
+
* @param {string} token
|
|
68
|
+
*/
|
|
69
|
+
SteamCommunity.prototype.setMobileAppAccessToken = function(token) {
|
|
70
|
+
if (!this.steamID) {
|
|
71
|
+
throw new Error('Log on to steamcommunity before setting a mobile app access token');
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
let decodedToken = Helpers.decodeJwt(token);
|
|
75
|
+
|
|
76
|
+
if (!decodedToken.iss || !decodedToken.sub || !decodedToken.aud || !decodedToken.exp) {
|
|
77
|
+
throw new Error('Provided value is not a valid Steam access token');
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (decodedToken.iss == 'steam') {
|
|
81
|
+
throw new Error('Provided token is a refresh token, not an access token');
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (decodedToken.sub != this.steamID.getSteamID64()) {
|
|
85
|
+
throw new Error(`Provided token belongs to account ${decodedToken.sub}, but we are logged into ${this.steamID.getSteamID64()}`);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (decodedToken.exp < Math.floor(Date.now() / 1000)) {
|
|
89
|
+
throw new Error('Provided token is expired');
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if ((decodedToken.aud || []).indexOf('mobile') == -1) {
|
|
93
|
+
throw new Error('Provided token is not valid for MobileApp platform type');
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
this.mobileAccessToken = token;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Verifies that the mobile access token we already have set is still valid for current login.
|
|
101
|
+
*
|
|
102
|
+
* @private
|
|
103
|
+
*/
|
|
104
|
+
SteamCommunity.prototype._verifyMobileAccessToken = function() {
|
|
105
|
+
if (!this.mobileAccessToken) {
|
|
106
|
+
// No access token, so nothing to do here.
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
let decodedToken = Helpers.decodeJwt(this.mobileAccessToken);
|
|
111
|
+
|
|
112
|
+
let isTokenInvalid = decodedToken.sub != this.steamID.getSteamID64() // SteamID doesn't match
|
|
113
|
+
|| decodedToken.exp < Math.floor(Date.now() / 1000); // Token is expired
|
|
114
|
+
|
|
115
|
+
if (isTokenInvalid) {
|
|
116
|
+
delete this.mobileAccessToken;
|
|
117
|
+
}
|
|
118
|
+
};
|
|
@@ -1,62 +1,81 @@
|
|
|
1
|
-
// If you aren't running this script inside of the repository, replace the following line with:
|
|
2
|
-
// const SteamCommunity = require('steamcommunity');
|
|
3
|
-
const SteamCommunity = require('../index.js');
|
|
4
|
-
const ReadLine = require('readline');
|
|
5
|
-
|
|
6
|
-
let community = new SteamCommunity();
|
|
7
|
-
let rl = ReadLine.createInterface({
|
|
8
|
-
input: process.stdin,
|
|
9
|
-
output: process.stdout
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
rl.question('Username: ', (accountName) => {
|
|
13
|
-
rl.question('Password: ', (password) => {
|
|
14
|
-
rl.question('Two-Factor Auth Code: ', (authCode) =>{
|
|
15
|
-
rl.question('Revocation Code: R', (rCode) => {
|
|
16
|
-
doLogin(accountName, password, authCode, '', rCode);
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
function doLogin(accountName, password, authCode, captcha, rCode) {
|
|
23
|
-
community.login({
|
|
24
|
-
accountName: accountName,
|
|
25
|
-
password: password,
|
|
26
|
-
twoFactorCode: authCode,
|
|
27
|
-
captcha: captcha
|
|
28
|
-
}, (err, sessionID, cookies, steamguard) => {
|
|
29
|
-
if (err) {
|
|
30
|
-
if (err.message == 'SteamGuard') {
|
|
31
|
-
console.log('This account does not have two-factor authentication enabled.');
|
|
32
|
-
process.exit();
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (err.message == 'CAPTCHA') {
|
|
37
|
-
console.log(err.captchaurl);
|
|
38
|
-
rl.question('CAPTCHA: ', (captchaInput) => {
|
|
39
|
-
doLogin(accountName, password, authCode, captchaInput);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
console.log(err);
|
|
46
|
-
process.exit();
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
console.log('Logged on!');
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
1
|
+
// If you aren't running this script inside of the repository, replace the following line with:
|
|
2
|
+
// const SteamCommunity = require('steamcommunity');
|
|
3
|
+
const SteamCommunity = require('../index.js');
|
|
4
|
+
const ReadLine = require('readline');
|
|
5
|
+
|
|
6
|
+
let community = new SteamCommunity();
|
|
7
|
+
let rl = ReadLine.createInterface({
|
|
8
|
+
input: process.stdin,
|
|
9
|
+
output: process.stdout
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
rl.question('Username: ', (accountName) => {
|
|
13
|
+
rl.question('Password: ', (password) => {
|
|
14
|
+
rl.question('Two-Factor Auth Code: ', (authCode) =>{
|
|
15
|
+
rl.question('Revocation Code: R', (rCode) => {
|
|
16
|
+
doLogin(accountName, password, authCode, '', rCode);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
function doLogin(accountName, password, authCode, captcha, rCode) {
|
|
23
|
+
community.login({
|
|
24
|
+
accountName: accountName,
|
|
25
|
+
password: password,
|
|
26
|
+
twoFactorCode: authCode,
|
|
27
|
+
captcha: captcha
|
|
28
|
+
}, (err, sessionID, cookies, steamguard) => {
|
|
29
|
+
if (err) {
|
|
30
|
+
if (err.message == 'SteamGuard') {
|
|
31
|
+
console.log('This account does not have two-factor authentication enabled.');
|
|
32
|
+
process.exit();
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (err.message == 'CAPTCHA') {
|
|
37
|
+
console.log(err.captchaurl);
|
|
38
|
+
rl.question('CAPTCHA: ', (captchaInput) => {
|
|
39
|
+
doLogin(accountName, password, authCode, captchaInput);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
console.log(err);
|
|
46
|
+
process.exit();
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
console.log('Logged on!');
|
|
51
|
+
|
|
52
|
+
if (community.mobileAccessToken) {
|
|
53
|
+
// If we already have a mobile access token, we don't need to prompt for one.
|
|
54
|
+
doRevoke(rCode);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
console.log('You need to provide a mobile app access token to continue.');
|
|
59
|
+
console.log('You can generate one using steam-session (https://www.npmjs.com/package/steam-session).');
|
|
60
|
+
console.log('The access token needs to be generated using EAuthTokenPlatformType.MobileApp.');
|
|
61
|
+
console.log('Make sure you provide an *ACCESS* token, not a refresh token.');
|
|
62
|
+
|
|
63
|
+
rl.question('Access Token: ', (accessToken) => {
|
|
64
|
+
community.setMobileAppAccessToken(accessToken);
|
|
65
|
+
doRevoke(rCode);
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function doRevoke(rCode) {
|
|
71
|
+
community.disableTwoFactor('R' + rCode, (err) => {
|
|
72
|
+
if (err) {
|
|
73
|
+
console.log(err);
|
|
74
|
+
process.exit();
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
console.log('Two-factor authentication disabled!');
|
|
79
|
+
process.exit();
|
|
80
|
+
});
|
|
81
|
+
}
|