Jain56 Posted May 23, 2016 Report Posted May 23, 2016 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. Quote
Dr. McKay Posted May 23, 2016 Report Posted May 23, 2016 You have to actually call logOn to connect to Steam and log on. Quote
Jain56 Posted May 23, 2016 Author Report Posted May 23, 2016 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. Quote
Dr. McKay Posted May 23, 2016 Report Posted May 23, 2016 Well, you wrapped everything in a "login" function. Call that. Quote
Jain56 Posted May 23, 2016 Author Report Posted May 23, 2016 (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 May 23, 2016 by Dr. McKay please use [code] tags Quote
Dr. McKay Posted May 23, 2016 Report Posted May 23, 2016 Is this module the entry point for your application? What output are you getting? Quote
Jain56 Posted May 23, 2016 Author Report Posted May 23, 2016 m not getting anything on client.on function(). Same thing working in my friends PC so m wondering what it is!i get totpcode though. Quote
Jain56 Posted May 24, 2016 Author Report Posted May 24, 2016 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. Quote
Dr. McKay Posted May 24, 2016 Report Posted May 24, 2016 Make sure your "output log" is capturing stdout. Quote
Recommended Posts
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.