I was wondering if it is possible to use Passport/OpenID for login validation and then transfer the session over to use the node-steamcommunity function calls. Currently I want to be able to post comments on user profiles, and the following works:
var SteamCommunity = require('steamcommunity');
var ReadLine = require('readline');
var fs = require('fs');
var community = new SteamCommunity();
var rl = ReadLine.createInterface({
"input": process.stdin,
"output": process.stdout
});
rl.question("Username: ", function(accountName) {
rl.question("Password: ", function(password) {
doLogin(accountName, password);
});
});
function doLogin(accountName, password, authCode, twoFactorCode, captcha) {
community.login({
"accountName": accountName,
"password": password,
"authCode": authCode,
"twoFactorCode": twoFactorCode,
"captcha": captcha
}, function(err, sessionID, cookies, steamguard) {
if(err) {
if(err.message == 'SteamGuardMobile') {
rl.question("Steam Authenticator Code: ", function(code) {
doLogin(accountName, password, null, code);
});
return;
}
if(err.message == 'SteamGuard') {
console.log("An email has been sent to your address at " + err.emaildomain);
rl.question("Steam Guard Code: ", function(code) {
doLogin(accountName, password, code);
});
return;
}
if(err.message == 'CAPTCHA') {
console.log(err.captchaurl);
rl.question("CAPTCHA: ", function(captchaInput) {
doLogin(accountName, password, authCode, twoFactorCode, captchaInput);
});
return;
}
console.log(err);
process.exit();
return;
}
console.log("Logged on!");
community.getSteamUser('username', function(err, user){
if (err) {
console.log(err);
} else {
user.comment('test comment', (err) => {
if (err) {
console.log(err);
} else {
console.log('comment posted successfully');
}
});
}
});
return;
});
}
But the doLogin() function will seem untrustworthy for end-users, so I would want to be able to use the standard "Sign In with Steam" as offered by Passport-Steam. Is there any way for me to do the login via Steam and then transfer those session details/cookies to use steamcommunity? Thanks for any help.