Jump to content
McKay Development

sessionExpired being called for no reason ?


DentFuse

Recommended Posts

Hi all, So this is my code :

community.on('sessionExpired', (err) =>{
  console.log("Session Expired !! Logging In Again...")
  if (a = 1) {
    a = 0
		login();
  }
});
community.on('disconnected', (err) =>{
  console.log("Disconnected !! Logging In Again...")
  if (a = 1) {
    a = 0
		login();
  }
});

So what is happening is that the sessionExpired is being called but when the bot is trying to log in, it crashes with an error stating that we are already logged in and we cannot log in again, also sometimes the bot crashes with an error saying the session was replaced or something like that, sorry I don't exactly remember, will post log when it happens again.

 

Any help would be greatly appreciated :)

 

PS: I've added that var a to make sure that the login function is called only once, I change it back to 1 once we get the webapi key from steam.

Link to comment
Share on other sites

It's being called for a reason, and that reason is that your session expired.

 

I assume that you're getting your session from node-steam-user, and you're calling logOn when it expires. That's wrong, you should call webLogOn.

 

Hey there! Thanks for your reply, so do you mean to say that I don't have to log in again when the session expires, but just call webLogOn(which gets a new session from steam? That's what I understood when I was reading the docs of node-steam-community)So all I have to do is replace my login function with a call to webLogOn ?

 

PS: I knew it was being called because our session expired, but wasn't sure why it was not logging in again...

Link to comment
Share on other sites

Correct. When you're using steam-user, your "login" is a connection to the CM. It's completely distinct from your web session. When your web session expires but you're still connected you don't need to reconnect. Just get a new web session which requests new cookies from the CM.

 

Now I get error saying that we must be logged in steam before we can login in steamcommunity.com. Should I call my login func before webLogOn ?

Link to comment
Share on other sites

Okay so update on my bot, couldn't get the sessionExpired thing working,tried .relog(), .webLogOn(), .LogOn(), still couldn't get it working, so I just attached the bot to forever, so like when ever it crashes due to sessionExpired, it just restarts it. Happens once a day, so that's not much of a problem, but yeah, thanks you for answers :)

 

PS: I'll still try to get it working ;P

Link to comment
Share on other sites

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