Jump to content
McKay Development

xawucy

Member
  • Posts

    4
  • Joined

  • Last visited

xawucy's Achievements

  1. the community.getWebApiKey method with this approach still works without a proxy, and very quickly gets a 429 error
  2. const { LoginSession, EAuthTokenPlatformType } = require('steam-session'); const SteamCommunity = require('steamcommunity'); const SteamTotp = require('steam-totp'); // Variable [[PROXY]] sets the proxy const proxyInput = [[PROXY]]; // Processing the proxy format let proxyUrl; if (proxyInput.includes('@')) { // Proxy with authorization const proxyParts = proxyInput.split('@'); const credentials = proxyParts[0].replace('http://', ''); const hostPort = proxyParts[1]; proxyUrl = `http://${credentials}@${hostPort}`; } else if (proxyInput.includes(':')) { // Proxy without authorization proxyUrl = `http://${proxyInput}`; } else { [[ERR]] = 2; [[ERR_DIS]] = "Invalid proxy format"; } // Credentials const username = [[LOGIN]]; const password = [[PASS]]; const sharedSecret = [[KEY]]; const identitySecret = [[IDENTITY_SECRET]]; // Generating TOTP code const twoFactorCode = SteamTotp.generateAuthCode(sharedSecret); // Creating a session with proxy const session = new LoginSession(EAuthTokenPlatformType.WebBrowser, { httpProxy: proxyUrl // Proxy for HTTP requests }); console.log("trying to log in"); await new Promise((resolve) => { session.on('authenticated', async () => { try { console.log("Successfully logged in"); // Checking refresh token const refreshToken = session.refreshToken; if (!refreshToken) { console.log("Error: refresh token is missing"); [[ERR]] = 2; [[ERR_DIS]] = "Refresh token is missing"; resolve(); return; } console.log("Refresh token received: " + refreshToken); // Getting cookies const webCookies = await session.getWebCookies(); console.log("Cookies: " + webCookies); const community = new SteamCommunity(); community.setCookies(webCookies); // Getting Web API key await new Promise((resolve) => { community.getWebApiKey((err, key) => { if (err) { console.log("Error getting Web API key: " + err.message); [[ERR]] = 1; [[ERR_DIS]] = err.message; resolve(); } else { console.log("Your Web API key: " + key); [[APIKEY]] = key; resolve(key); } }); }); } catch (err) { console.log("Error getting cookies: " + err.message); [[ERR]] = 2; [[ERR_DIS]] = err.message; } resolve(); }); session.on('error', (err) => { console.log("Login error: " + err.message); [[ERR]] = 2; [[ERR_DIS]] = err.message; resolve(); }); session.startWithCredentials({ accountName: username, password: password, steamGuardCode: twoFactorCode }); }); Is this how it will work or did I misunderstand?
  3. Please tell me how to use this library
  4. Previously I used it like this: const community = new SteamCommunity({ request: Request.defaults({ forever: true, proxy: proxy, }), }); now with this approach I get an error: Error: SteamCommunity.login() is incompatible with node-steamcommunity v3's usage of 'request'. If you need to specify a custom 'request' instance (e.g. when using a proxy), use https://www.npmjs.com/package/steam-session directly to log onto Steam. please tell me what should I do now?
×
×
  • Create New...