So just using steam-user by itself should allow this to work? Originally I was trying to use node-steam directly which is why that case is in there and I thought I did everything right but I was getting this same steamguard loop which is what led me to steam-user. I'm going to try rewriting my code without the extra seishun stuff and see if it works. Thanks for your advice. EDIT: It works now, thank's dr. mckay. For anybody who comes across this thread on a google search here's the updated code:
var fs = require("fs"),
Steam = require("steam"),
SteamUser = require("steam-user"),
SteamID = require("steamid"),
readLine = require('readline-sync'),
SteamClients = {},
SteamUsers = {},
SteamFriends = {};
var text = fs.readFileSync("accounts.json").toString();
var accounts = JSON.parse(text)["accounts"];
accounts.forEach(doTheStuff);
function doTheStuff(element,indexElement,array) {
//console.log(element["username"] + ": " + element["password"]);
SteamUsers[indexElement] = new SteamUser();
SteamUsers[indexElement].setOption('promptSteamGuardCode', false);
SteamUsers[indexElement].setOption('dataDirectory', './sentry')
SteamUsers[indexElement].on('steamGuard', function(domain, callback, lastCodeWrong){
var code = readLine.question("Enter steamguard code from " + element["username"] + '(' + domain + ')');
callback(code);
});
SteamUsers[indexElement].on("loggedOn", function(details, parental) {
console.log("Logged on as " + element["username"] + " successfully");
console.log(details);
console.log(parental);
});
SteamUsers[indexElement].on("error", function(err){
console.log("Error! " + element["username"]);
console.log(err);
});
SteamUsers[indexElement].on("disconnect", function(err) {
console.log("Disconnected from " + element["username"]);
console.log(err);
});
SteamUsers[indexElement].logOn(
{
accountName: element["username"],
password: element["password"]
}
);
}