-
Posts
6 -
Joined
-
Last visited
Posts posted by ElijahPepe
-
-
How would I make the log in process asynchronous, then? I looked at the README but couldn't find anything.
-
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.
-
I'm not getting any output. When I console.log accessToken, null is returned.
-
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.
-
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?
Handling .logOn() asynchronously
in node-steam-user
Posted
I have two functions in a class:
When I call the login() function, .logOn() is resolved before the loggedOn event can be fired. Is there a way of using .logOn() asynchronously?