Jump to content
McKay Development

Recommended Posts

Posted

Hi i using this code for login
 

function login(err, sessionID, cookies, steamguard) {
	if(err) {
		logger.error('Auth error');
		logger.debug(err);
		if(err.message == "SteamGuardMobile") {
			account.twoFactorCode = SteamTotp.generateAuthCode(account.shared_secret);
			logger.warn('Error in auth: '+account.twoFactorCode);
			setTimeout(function() {
				community.login(account, login);
			}, 5000);
			return;
		}
		process.exit(0);
	}
	logger.trace('Sucesfully auth');
	account.sessionID = sessionID;
	account.cookies = cookies;
	community.getWebApiKey('secrect.com', webApiKey);
	community.startConfirmationChecker(10000, account.identity_secret);
	
}

after 2 ~ 3 days i lost my session, and i use this for new loggin

community.on('sessionExpired', function(err) {
	if (err) {
		console.log('sessionExpired: '+err);
	}
	community.stopConfirmationChecker();
	community.login(account, login);
	
	console.log('=======New Session=========');
});

How I force to lose my session? for testing my code? It's horrible to have to wait 2 ~ 3 days

Sorry my english...

  • 1 month later...
Posted (edited)

 

A pretty easy way to invalidate your session:

community.setCookies(["steamLogin=invalid", "steamLoginSecure=invalid"]);

 

Then I set it, I get this error:

 

/node_modules/steamcommunity/index.js:241
            self.steamID = new SteamID(cookie.match(/=(\d+)/)[1]);
                                                             ^


TypeError: Cannot read property '1' of null
    at /node_modules/steamcommunity/index.js:241:53
    at Array.forEach (native)
    at SteamCommunity.setCookies (/node_modules/steamcommunity/index.js:238:10)
    at manager.setCookies (/index.js:120:28)
    at checkDone (/node_modules/steam-tradeoffer-manager/lib/index.js:98:4)
    at _community.getWebApiKey (/node_modules/steam-tradeoffer-manager/lib/index.js:149:3)
    at SteamCommunity.<anonymous> (/node_modules/steamcommunity/components/webapi.js:21:4)
    at Request._callback (/node_modules/steamcommunity/components/http.js:67:15)
    at Request.self.callback (/node_modules/request/request.js:188:22)
    at emitTwo (events.js:106:13)
    at Request.emit (events.js:191:7)
    at Request.<anonymous> (/node_modules/request/request.js:1171:10)
    at emitOne (events.js:96:13)
    at Request.emit (events.js:188:7)
    at Gunzip.<anonymous> (/node_modules/request/request.js:1091:12)
    at Gunzip.g (events.js:291:16)

 

What am I doing wrong?

Edited by DevDuck

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