Avolis Posted May 11, 2023 Report Posted May 11, 2023 When I try to sign in it's totally fine but if I wanted to sign in to another account after 5 seconds I get this error. I don't understand what causes this. I am just trying to sign in. if I want to sign in using chrome it's totally fine I can sign in with 10 accounts at the same time with different chromes. But why do I get this error when I sign in with code? var a = 0; var refreshInterval = setInterval(() => doLogin(communities[a], usernames[a], passwords[a],steamTotp.generateAuthCode(Secrets[a + 299]).toString()), 500); function doLogin(community, accountName, password, authCode) { community.login({ accountName: accountName, password: password, twoFactorCode: authCode, }, (err, sessionID, cookies, steamguard) => { if (err) { if (err.message == 'SteamGuard') { console.log('This account does not have two-factor authentication enabled.'); process.exit(); return; } if (err.message == 'CAPTCHA') { console.log(err.captchaurl); rl.question('CAPTCHA: ', (captchaInput) => { doLogin(accountName, password, authCode, captchaInput); }); return; } console.log(err); process.exit(); return; } community.profileSettings({ gameDetails:SteamCommunity.PrivacyState.Public }); a++; if(a >= 10){ clearInterval(refreshInterval); } console.log("Privacy settings changed successufly"); }); } Quote
Dr. McKay Posted May 11, 2023 Report Posted May 11, 2023 You might run into fewer rate limits using steam-session to login and get your cookies. Quote
Avolis Posted May 12, 2023 Author Report Posted May 12, 2023 (edited) When I run the code session.steamID and account name are always undefined and null. const steamTotp = require('steam-totp'); const {LoginSession, EAuthTokenPlatformType} = require('steam-session'); const { EResult } = require('steam-user'); let session = new LoginSession(EAuthTokenPlatformType.WebBrowser); session.startWithCredentials({ accountName: 'username', password: 'password', steamGuardMachineToken: steamTotp.generateAuthCode('mysecret') }); var refreshInterval = setInterval(() => console.log(session._accountName), 1000); var refreshInterval = setInterval(() => console.log(session.steamID), 1000); But if I change it to steamClient instead of WebBrowser in the output I see. null undefined SteamID {universe: 1, type: 1, instance: 1, accountid: 1522534272} undefined SteamID {universe: 1, type: 1, instance: 1, accountid: 1522534272} undefined SteamID {universe: 1, type: 1, instance: 1, accountid: 1522534272} undefined SteamID {universe: 1, type: 1, instance: 1, accountid: 1522534272} undefined SteamID {universe: 1, type: 1, instance: 1, accountid: 1522534272} undefined SteamID {universe: 1, type: 1, instance: 1, accountid: 1522534272} Why can't I have the account name? I don't get any error so that means I am able to login on both code right? Edit: what the accountid: 1522534272 means? It's not my steam accounts id. Edit2: When I change SteamGuardMachineToken with steamGuardCode I am able to have cookies and username and all. Thanks for the cookies. Now I should save this loginsecure code and use it on the steam-community login part right? I will continue to that session with the cookie. I am so new around here I am telling this for you to correct me if I am wrong. Thanks in advance. Edited May 12, 2023 by Avolis Quote
Avolis Posted May 12, 2023 Author Report Posted May 12, 2023 When I wanted to use setCookies function I get an error. Uncaught TypeError TypeError: cookies.forEach is not a function at SteamCommunity.setCookies (c:\Users\Okan\node_modules\steamcommunity\index.js:297:10) at <anonymous> (c:\Users\Okan\Desktop\Change.js:21:16) at Module._compile (internal/modules/cjs/loader:1254:14) at Module._extensions..js (internal/modules/cjs/loader:1308:10) at Module.load (internal/modules/cjs/loader:1117:32) at Module._load (internal/modules/cjs/loader:958:12) at executeUserEntryPoint (internal/modules/run_main:81:12) at <anonymous> (internal/main/run_main_module:23:47) Did I installed the stemcommunity module wrong? This is the line of code that I set the cookies. I set the cookies before the login attempt. community.setCookies('steamLoginSecure=76561199482.........'); Quote
Avolis Posted May 13, 2023 Author Report Posted May 13, 2023 (edited) Am I have to login after setting the cookies? I was reading the wiki page about cookies it says that setCookies method used for resuming a previous session. And is loginSecure cookie enough? I created a SteamCommunity array to use one SteamCommunity class for individual accounts, and I set the cookies. var a = 0; communities[a].setCookies(["steamLoginSecure=76561199482800.........", "sessionid=8aecff1a.........."]); communities[a+1].setCookies(["steamLoginSecure=7656119...", "sessionid=906....."]); communities[a+2].setCookies(["steamLoginSecure=7656119948259173.....","sessionid=247e3950...."]); setInterval(() => doLogin(communities[a], usernames[a], passwords[a], steamTotp.generateAuthCode(Secrets[a])), 5000); Inside the dologin function I used login function, and increased 'a' after each account completes it's thing. But still after 2 logins third one throws http 429 error. I couldn't get around this error. Am I doing something wrong with the cookies or am I using wrong methods to logIn or am I not continuing the session? Edited May 13, 2023 by Avolis Quote
Dr. McKay Posted May 14, 2023 Report Posted May 14, 2023 Once you have cookies set, you're logged in (assuming they're still valid). You don't need to call login again. And yes, steamLoginSecure is all you should need, although you might run into trading problems if you don't also include steamMachineAuth<steamid>, if the cookies didn't come from steam-user. Quote
Avolis Posted May 14, 2023 Author Report Posted May 14, 2023 (edited) I commented the login part of the code so it's disabled now .After I set the cookies I checked if I am loggedin or not. On console it always logs false. I get the cookies from my webbrowser and they are still valid. What seems the be the issue here? Loggedin callback runs after login function only? Is that the reason it always logs false? But Im sure I am not logged in because I tried to edit the profile name it doesn't work but if I use login method it works. communities[a] setInterval(() => communities[a].loggedIn((err,result) => { console.log(result); }), 500); Edit: I logged of from my browser and logged in again to get new cookies. Now it logs true. But why the previous one wasn't working? It was working on my browser pretty well. I was able to edit my account with the browser. Should I do something to make that cookie last longer or set some other cookies? Edit2: I used steam-session module and getWebCookies function to extract cookies. I did but sometimes it yields steamcountry cookie with loginsecure cookie, but sometime it yields sessionId cookie with loginsecure cookie. Do I need these sessionId and steamcountry cookies? What are the restrictions if I don't set them? Edited May 14, 2023 by Avolis Quote
Dr. McKay Posted May 15, 2023 Report Posted May 15, 2023 You don't need sessionid or steamcountry. There are no restrictions if you don't set them. 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.