timetoshine Posted March 4, 2022 Report Posted March 4, 2022 (edited) My project is very simple. All I want to do is change my profile name by running a script. The name is hard coded, the account is hard coded. I'm trying to log in without having to provide the two factor code each time I want to run this script. My final goal is to be able to run this script with a push of a button. I was able to get it working with this: const SteamCommunity = require('steamcommunity') const Community = new SteamCommunity() Community.login( { "accountName": "", "password": "", "authCode": "", "disableMobile": false }, (err, sessionID, steamguard, oAuthToken) => { Community.editProfile( { name: "anything" }, (err) => { console.log("anything", err) } ) } ) obviously filling out the correct info for my account. Without having steam guard, I was able to change the name no problem. However I want steam guard enabled for obvious reasons but every time I want to run this code, I don't want to input the new authCode. I can't figure out how to get oAuthLogin(steamguard, oAuthToken, callback) working. The steamguard parameter is confusing to me because the documentation says it's this "YourSteamID||YourCookieValue" but when I get the return it's an array so I can't just pass what I get into oAuthLogin and when I tried to make it a string, I just recreated the oAuthToken thinking I was combining the right info. My last run ended up with a 401 error and I'm just completely lost. This is also my first time working with node. Any advice on what to try or direction of where I should be looking? Solution: Edited March 7, 2022 by timetoshine solution posted Quote
Dr. McKay Posted March 4, 2022 Report Posted March 4, 2022 The arguments passed to the login callback are err, sessionID, cookies, steamguard, oAuthToken. You've left out the cookies argument, which is why you aren't getting the correct value in steamguard. Quote
timetoshine Posted March 5, 2022 Author Report Posted March 5, 2022 (edited) 4 hours ago, Dr. McKay said: The arguments passed to the login callback are err, sessionID, cookies, steamguard, oAuthToken. You've left out the cookies argument, which is why you aren't getting the correct value in steamguard. I'm so dumb. Thanks! That was it. I was able to get it working with an email authentication code. I'm now stuck on a mobile code account. When trying to use the steamguard param on login, I get back "Error: SteamGuardMobile" Community.login( { "accountName": CONFIG.accountName, "password": CONFIG.password, "steamguard":CONFIG.steamguard, //"authCode": "", // email code //"twoFactorCode": "", // app code "disableMobile": false } , (err, sessionID, cookies, steamguard, oAuthToken) => { if(err) console.log("failed to login: ", err) console.log(steamguard) console.log(oAuthToken) } ) it works when I put the two factor code in but I'm trying to not have to reenter a code every time I run it. Edited March 5, 2022 by timetoshine Quote
Dr. McKay Posted March 5, 2022 Report Posted March 5, 2022 Are you giving it a two factor code? Quote
timetoshine Posted March 7, 2022 Author Report Posted March 7, 2022 On 3/5/2022 at 4:20 PM, Dr. McKay said: Are you giving it a two factor code? I did in order to get the steamguard string and I was trying to use that to login so I wouldn't have to twofactor every time. Quote
timetoshine Posted March 7, 2022 Author Report Posted March 7, 2022 I have solved this. I used the oAuthLogin. Originally I thought it was out of the question because the regular login worked for the email two factor code. I just tried oAuthLogin with my steamguard and oauth token and it worked with no issues. Code that works: Community.oAuthLogin(CONFIG.steamguard, CONFIG.oAuthToken, err => { Community.editProfile( { name: CONFIGNAME.name }, (err) => { if(err) console.log("failed to change name: ", err) } ) }) Quote
Dr. McKay Posted March 7, 2022 Report Posted March 7, 2022 Yeah, that should work for you. If you're logging in with an account name and password to an account that has mobile 2FA enabled, you need to provide a code every time even if you pass the steamguard string. timetoshine 1 Quote
_Tony Posted December 28, 2023 Report Posted December 28, 2023 @timetoshine @Dr. McKay Could you please help me out? i'm also trying to use Community.oAuthLogin How do i get steamguard and oAuthToken? After? Community.login Quote
Dr. McKay Posted December 28, 2023 Report Posted December 28, 2023 42 minutes ago, _Tony said: How do i get steamguard and oAuthToken? You can't, neither of these work anymore. 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.