Jump to content
McKay Development

Handling .logOn() asynchronously


Recommended Posts

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;


When I call the login() function, .logOn() is resolved before the loggedOn event can be fired. Is there a way of using .logOn() asynchronously?

Link to comment
Share on other sites

  • 4 weeks later...

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.

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.

  • Create New...