Jump to content
McKay Development

Recommended Posts

Posted

I am using node steam-user module in nodejs. When I am creating client using following code:-

 

  var client = new SteamUser({
        promptSteamGuardCode: false
    });
 
I can't get into this function.It doesn't respond at all.
 
 client.on('loggedOn', function(detail) {
        console.log("Logged in with ");
    });

 

i have also tried on('debug')

 

 

nothing works. please help.

 

It works in my friends pc .

OS-windows 7.

Posted
var SteamUser = require('steam-user'),
    SteamTOTP = require('steam-totp'),
    TradeOfferManager = require('steam-tradeoffer-manager'),
    path = require('path'),
    config = require(path.resolve('./config/config')),
    appId = config.steam.appId, //app id of CS GO
    contextId = config.steam.contextId;
 
var offers;
 
var login = function() {
    var client = new SteamUser({
        promptSteamGuardCode: false
    });
 
    client.logOn({
        accountName: config.steam.accountName,
        password: config.steam.password
    });
    client.on('loggedOn', function(detail) {
        console.log("Logged in with ");
    });
 
    client.on('error', function(err) {
        console.log(err);
    });
 
    var getTOTPCode = function() {
        var code = SteamTOTP.generateAuthCode(config.steam.sharedSecret);
        console.log("code = " + code);
        return code;
    };
 
    client.on('steamGuard', function(doamin, callback) {
        var code = getTOTPCode();
        callback(code);
    });


i did that too....as i said its wrking in my friend's pc.
Posted (edited)

'use strict';
 
var SteamUser = require('steam-user'),
    SteamTOTP = require('steam-totp'),
    TradeOfferManager = require('steam-tradeoffer-manager'),
    path = require('path'),
    config = require(path.resolve('./config/config')),
    appId = config.steam.appId, //app id of CS GO
    contextId = config.steam.contextId;
 
var offers;
 
var login = function() {
    var client = new SteamUser({
        promptSteamGuardCode: false
    });
 
    client.logOn({
        accountName: config.steam.accountName,
        password: config.steam.password
    });
    client.on('loggedOn', function(detail) {
        console.log("Logged in with ");
    });
 
    client.on('error', function(err) {
        console.log(err);
    });
 
    var getTOTPCode = function() {
        var code = SteamTOTP.generateAuthCode(config.steam.sharedSecret);
        console.log("code = " + code);
        return code;
    };
 
    client.on('steamGuard', function(doamin, callback) {
        var code = getTOTPCode();
        callback(code);
    });
 
    client.on('webSession', function(sessionID, cookies) {
        console.log("Got web session");
        // Set our status to "Online" (otherwise we always appear offline)
 
        offers = new TradeOfferManager({
            steam: client,
            domain: "localhost:8083",
            language: "en", // English item descriptions
            pollInterval: 10000, // (Poll every 10 seconds (10,000 ms)
            cancelTime: 300000 // Expire any outgoing trade offers that have been up for 5+ minutes (300,000 ms)
        });
        client.setPersona(SteamUser.Steam.EPersonaState.Online);
        offers.setCookies(cookies, function(err) {
            if (err) {
                console.log('Unable to set trade offer cookies: ' + err);
            }
            console.log("Trade offer cookies set.  Got API Key: " + offers.apiKey);
        });
    });
 
    return client;
};
 
 
module.exports = login();
module.exports.offer = function(){
return offers;
};

 

 

this is my whole code. i did call login function.

Edited by Dr. McKay
please use [code] tags
Posted

Yes that is the entry point of my application. and in output log i don't see anything being traced. But  my getTOTPCode function is working fine. I have windows 64bit and installed node in program files.

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