xawucy Posted January 1 Report Posted January 1 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? Quote
Dr. McKay Posted January 2 Report Posted January 2 Use https://www.npmjs.com/package/steam-session directly to log onto Steam. Quote
xawucy Posted January 2 Author Report Posted January 2 3 hours ago, Dr. McKay said: Use https://www.npmjs.com/package/steam-session directly to log onto Steam. Please tell me how to use this library Quote
xawucy Posted January 2 Author Report Posted January 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? Quote
xawucy Posted January 2 Author Report Posted January 2 the community.getWebApiKey method with this approach still works without a proxy, and very quickly gets a 429 error Quote
rootqwe Posted Sunday at 10:31 PM Report Posted Sunday at 10:31 PM On 1/2/2025 at 9:33 AM, Dr. McKay said: Use https://www.npmjs.com/package/steam-session directly to log onto Steam. Please example, I need to add authenticator into the steam via node and proxy but I dont understand. How I can to link steam-session and node-steamcommunity mobile session from proxy? 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.