lupucl Posted April 8, 2022 Report Posted April 8, 2022 (edited) Hi, is there any way to add in client.logOn something like steamGuard? I would like to take the steamguard from an input. const SteamUser = require("steam-user"); app.post('/account', function(req, res) { const SteamUsername = req.body.SteamUsername; const SteamPassword = req.body.SteamPassword; const title = "test"; const games = 720; // Authorization const client = new SteamUser(); client.logOn({ accountName: SteamUsername, password: SteamPassword }); client.on("loggedOn", async () => { await Array.prototype.push.apply( title, games ); await client.setPersona( SteamUser.EPersonaState.Online ); await client.gamesPlayed( title ); console.log(`Logged succesfully as ${SteamUsername}.`); }); }); Edited April 8, 2022 by lupucl question Quote
lupucl Posted April 9, 2022 Author Report Posted April 9, 2022 (edited) Sorry, I was in a rush. Basically, what I did is, checking the user and password from HTML input. What I want now, is to do the same with Steam Guard. Is there any way to do that? And, one more thing? The "Steam Guard App" message from console, can be changeable? Because I couldn't find anything on github. Edit// I've come with a better idea. How can I read the steamguard from a file? Edit2// Is there any way to logOff a specific user? Like, logOff and steam username? Thanks. Edited April 10, 2022 by lupucl Quote
Dr. McKay Posted April 12, 2022 Report Posted April 12, 2022 On 4/9/2022 at 6:22 PM, lupucl said: Sorry, I was in a rush. Basically, what I did is, checking the user and password from HTML input. What I want now, is to do the same with Steam Guard. Is there any way to do that? You can supply a Steam Guard code to logOn by passing it as twoFactorCode. On 4/9/2022 at 6:22 PM, lupucl said: And, one more thing? The "Steam Guard App" message from console, can be changeable? Because I couldn't find anything on github. If you listen for the steamGuard event, the "Steam Guard App Code" prompt is suppressed. You could create your own prompt if you wanted. On 4/9/2022 at 6:22 PM, lupucl said: Edit// I've come with a better idea. How can I read the steamguard from a file? Probably something like this: user.logOn({ accountName: 'example', password: 'example', twoFactorCode: require('fs').readFileSync('appcode.txt').toString('utf8').trim() }); On 4/9/2022 at 6:22 PM, lupucl said: Edit2// Is there any way to logOff a specific user? Like, logOff and steam username? Just call logOff on the appropriate SteamUser instance. Quote
lupucl Posted April 12, 2022 Author Report Posted April 12, 2022 Thank you so much!!! I've managed to solve most of the things, but, about the logOff thing. Could you give me an actual example? Thanks again, and have a good one!! Quote
Dr. McKay Posted April 12, 2022 Report Posted April 12, 2022 I'm assuming you're running multiple instances, so here's a way to keep track of them: let accounts = {}; function loginAccount(accountName, password, twoFactorCode) { if (accounts[accountName]) { throw new Error(`Account ${accountName} is already created`); } let user = new SteamUser(); accounts[accountName] = user; user.logOn({ accountName, password, twoFactorCode }); } function logoutAccount(accountName) { if (!accounts[accountName]) { throw new Error(`No SteamUser for ${accountName}`); } accounts[accountName].logOff(); accounts[accountName] = null; } lupucl 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.