Jump to content
McKay Development

Recommended Posts

Posted (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 by lupucl
question
  • lupucl changed the title to Steamguard input
Posted (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 by lupucl
Posted
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.

Posted

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!!

Posted

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;
}

 

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...