Jump to content
McKay Development

node-steam-user question about logOn method


johnnyJ

Recommended Posts

You can't know until you try to login. If settings are left at their default, the module will prompt for the appropriate code from stdin. You can set promptSteamGuardCode to false and listen for the steamGuard event if you want, and that will also tell you what kind of code it needs.

Link to comment
Share on other sites

You can't know until you try to login. If settings are left at their default, the module will prompt for the appropriate code from stdin. You can set promptSteamGuardCode to false and listen for the steamGuard event if you want, and that will also tell you what kind of code it needs.

I set promptSteamGuardCode to false but steamGuard event still doesnt work

var SteamUser = require('steam-user'); // Replace this with `require('steam-user');` if used outside of the module directory
var client = new SteamUser();

client.setOption(SteamUser.promptSteamGuardCode, false);

client.logOn({
	"accountName": "accountName",
	"password": "password"
});

client.on('loggedOn', function(details) {
	console.log("Logged into Steam as " + client.steamID.getSteam3RenderedID());
	client.setPersona(SteamUser.EPersonaState.Online);
	client.gamesPlayed(440);
	setTimeout(function() {
		client.logOff();
		console.log("Bye");
	}, 3000);
});

client.on('error', function(e) {
	// Some error occurred during logon
	console.log(e);
});

client.on('steamGuard', function(domain, callback) {
	console.log("Steam Guard code needed from email ending in " + domain);
	console.log("dsmdsad");
	var code = getCodeSomehow();
	callback(code);
});

client.on('webSession', function(sessionID, cookies) {
	console.log("Got web session");
	// Do something with these cookies if you wish
});

client.on('emailInfo', function(address, validated) {
	console.log("Our email address is " + address + " and it's " + (validated ? "validated" : "not validated"));
});

client.on('wallet', function(hasWallet, currency, balance) {
	console.log("Our wallet balance is " + SteamUser.formatCurrency(balance, currency));
});

client.on('vacBans', function(numBans, appids) {
	console.log("We have " + numBans + " VAC ban" + (numBans == 1 ? '' : 's') + ".");
	if (appids.length > 0) {
		console.log("We are VAC banned from apps: " + appids.join(', '));
	}
});
Edited by johnnyJ
Link to comment
Share on other sites

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