Jump to content
McKay Development

ElijahPepe

Member
  • Posts

    6
  • Joined

  • Last visited

ElijahPepe's Achievements

  1. I have two functions in a class: login(username, password) { this.steamUser.logOn({ accountName: username, password: password }); this.steamUser.on('loggedOn', async () => { await this._getAccessToken(); return this.accessToken; }); } _getAccessToken() { return new Promise(resolve => { this.steamUser.getEncryptedAppTicket(1818750, async (err, appTicket) => { if (err) { throw new Error(err); } const data = await this.info(appTicket.toString('hex').toUpperCase()); this.accessToken = data.token; resolve(this); }); }); } When I call the login() function, .logOn() is resolved before the loggedOn event can be fired. Is there a way of using .logOn() asynchronously?
  2. How would I make the log in process asynchronous, then? I looked at the README but couldn't find anything.
  3. Here's the full code: return new Promise(resolve => { if (!username || !password || typeof username !== 'string' || typeof password !== 'string') { throw new Error('Invalid username or password provided.'); } this.steamUser.logOn({ accountName: username, password: password, twoFactorCode: twoFactorCode }); console.log(this.steamUser); this.steamUser.on('loggedOn', details => { console.log(details) this.steamUser.getEncryptedAppTicket(1818750, async (err, appTicket) => { console.log(appTicket); if (err) { throw new Error(err); } const data = await this.info(appTicket.toString('hex')); console.log(data); this.accessToken = data.token; }); }); resolve(this); }); this.steamUser is a construct of SteamUser. Any of the console.logs don't seem to work, although on rare occasions this.steamUser and details are logged to the console.
  4. I'm not getting any output. When I console.log accessToken, null is returned.
  5. I've set twoFactorCode to the current value in my Steam app, but the steamGuard event doesn't seem to emit and the .logOn() function doesn't seem to properly log the user in.
  6. I'm using steam-user in a project where I can't get a Steam Guard code from a user through stdin. I'm using the following code, but it's inconsistent: this.steamUser.logOn({ accountName: username, password: password, twoFactorCode: twoFactorCode }); this.steamUser.on('steamGuard', (_domain, callback) => { callback(twoFactorCode); }); this.steamUser.on('loggedOn', () => { this.steamUser.getEncryptedAppTicket(1818750, async (err, appTicket) => { if (err) { throw new Error(err); } const data = await this.info(appTicket.toString('hex')); this.accessToken = data.token; }); }); resolve(this); The above code works occasionally, but in the few times that it does work, nothing in the .getEncryptedAppTicket() block is executed. What am I doing wrong?
×
×
  • Create New...