steamcommunity-mobile-confirmations
steamcommunity-mobile-confirmations copied to clipboard
webCookie problem
My Code:
function reWebLogOn(steam, callback) {
steam.webLogOn(function(newCookie){
helper.msg('webLogOn ok');
cookies = newCookie;
offers.setup({
sessionID: currentSessionId,
webCookie: newCookie
}, function(){
if (typeof callback == "function") {
callback();
}
});
var SteamCommunity = require('steamcommunity');
var community = new SteamCommunity();
var SteamTotp = require('steam-totp');
require('./node_modules/steamcommunity/components/confirmations.js');
var SteamCommunity = require('steamcommunity');
var SteamTotp = require('steam-totp');
var code = SteamTotp.generateAuthCode('');
console.log(code);
var client = new SteamCommunity();
client.login({
"accountName": "",
"password": "",
"twoFactorCode": code
}, function(err, sessionId, cookies, steamguard) {
var hash = require('crypto').createHash('sha1');
hash.update(Math.random().toString());
hash = hash.digest('hex');
device_id = 'android:' + hash;
console.log(this.device_id);
var SteamcommunityMobileConfirmations = require('steamcommunity-mobile-confirmations');
var steamcommunityMobileConfirmations = new SteamcommunityMobileConfirmations(
{
steamid: "...",
identity_secret: "=",
device_id: this.device_id,
webCookie: newCookie
});
steamcommunityMobileConfirmations.FetchConfirmations((function (err, confirmations)
{
if (err)
{
console.log(err);
return;
}
console.log('steamcommunityMobileConfirmations.FetchConfirmations received ' + confirmations.length + ' confirmations');
if ( ! confirmations.length)
{
return;
}
steamcommunityMobileConfirmations.AcceptConfirmation(confirmations[0], (function (err, result)
{
if (err)
{
console.log(err);
return;
}
console.log('steamcommunityMobileConfirmations.AcceptConfirmation result: ' + result);
}).bind(this));
}).bind(this));
})
});
}
The problem is that the only way the boat can start. And he confirms only one trade at startup. How can this problem be solved? If this code use return in a different place, then gives an error "Can not read property 'forEach' of undefined"
Or how to get webCookies?
Same problem! Only 1 offer at startup.
The sample code you're using is only meant to confirm one trade when it is ran. It needs to be modified to iterate the confirmations array.
How did you get it to work at all? I can't figure out what it wants for "webCookie"