GithubHelp home page GithubHelp logo

Comments (20)

wazerstar avatar wazerstar commented on September 1, 2024 1

@gmmanonymus111 @wazerstar My original approach with SAM was to do what you suggest and enter the login fields manually somehow in order to get Steam to remember the last logged in account, but I ran into exactly what you're describing with the window not being fully initialized. I hesitate to just go the easy route with timers as that may still not handle every situation correctly if a user has a terribly slow PC and leaving users with too much time between actions probably isn't the right way to do it either.

I'm at work at the moment, but when I get home later today I will take another stab at coming up with a good way to make sure the windows are loaded fully before trying to enter any information. I will also consider making Steam shut down properly using the command instead of trying to end the task directly as this could be causing problems as you said.

I very much appreciate you both helping me out with this.

sounds good, just remember to make a second check when doing steam.exe -shutdown, If i remember correctly you cannot shutdown steam while a game is open hence it will say a game is still running, please exit before closing steam..

edit
I just tested, it works brilliant, you cannot exit steam from the steam gui without it complaining but cmd line works fine so skip that :)

from sam.

wazerstar avatar wazerstar commented on September 1, 2024 1

A steam guard code takes very long time to expire even after it has already been renewed by another code, you can check for your self, copy one and wait a few minutes, it will still work :)

from sam.

gmmanonymus111 avatar gmmanonymus111 commented on September 1, 2024 1

@rex706 Well, I tought it would be a good idea to sync with steam's time before generating a code to avoid problems in case something with local time is not right but if the generation works (even better) without steam time, I won't complain.

from sam.

rex706 avatar rex706 commented on September 1, 2024

SAM will wait for the 2FA window to show before continuing execution if a shared secret is configured for the account. Are you clicking on anything else while waiting for SAM to log you in after selecting an account? This shouldn't matter, though, as it will focus the 2FA window after the code is generated.

from sam.

wazerstar avatar wazerstar commented on September 1, 2024

No it tries actually to inject before and says that the it was invalid in steam, I do not touch anything, if anything its because of the freeze in the app of SAM.

from sam.

rex706 avatar rex706 commented on September 1, 2024

Very weird. I have multiple accounts with 2FA active working fine.

You configured the shared secrets for the respective accounts, correct?

Feel free to add me on Discord so we can discuss your issues more easily: rex706#6521

Edit: If I was not clear originally, to get 2FA to work you have to include the 'shared secret' that is generated in your .maFile for that account using Steam Desktop Authenticator. If you use encryption, you may have to temporarily disable it to find the info you need when opening it with a program like Notepad. To update an existing account in SAM, just right click any account button and hit 'Edit' through the context menu to provide the shared secret.

from sam.

rex706 avatar rex706 commented on September 1, 2024

I think I now get what you mean. Sorry for not understanding at first.

Apparently the 2FA does not work the second time a 2FA account is used with the same instance of SAM running. I have replicated this problem and will come up with a fix for it soon.

In the mean time, though, you should be able to just close and reopen SAM to log into the other account you need.

from sam.

wazerstar avatar wazerstar commented on September 1, 2024

Here's what I did as of with 1.2.3.1.

I was already logged in by manual.

I have 2 accounts added with 2fa and steam profiles.

I click on the second added account, it logs in fine.

Then I try to test account "first being added"

it logs into steam and still gives the 2fa error where SAM freezes.

I then do what you told me to do, shut down SAM and try opening the account again, but SAM closes instantly just as before.

update
After having steam.exe running in the background, SAM does not close instantly now.

So there's a bug with SAM not and a check about steam process not being there and then closes.

from sam.

wazerstar avatar wazerstar commented on September 1, 2024

Not sure if you closes steam properly from the looks of it you do not send a proper shutdown to steam, instead force closing/crashing it?, but steam actually allows command line to be executed for shutdown.

Think that would much more safe to use and also make sure steam shuts down properly, and then check if all its processes are closes or not.

ie.
steamwebhelper.exe
steam.exe
SteamService.exe

cmd
steam.exe -shutdown

from sam.

gmmanonymus111 avatar gmmanonymus111 commented on September 1, 2024

@rex706 @wazerstar I think the problem is that SAM tries to enter the 2fa code before the steam prompt loads properly. I encountered this problem after modifying the code to type user/pass (instead of -login parameter) to make steam save the password.
SAM missed the first 4 characters of my usernames there, after adding a 5-second delay, it worked. I think 500-1000 ms should be enough for 2fa popup.
Or we need an other reliable way to check if steam's prompt loaded completely.

from sam.

wazerstar avatar wazerstar commented on September 1, 2024

@rex706 @wazerstar I think the problem is that SAM tries to enter the 2fa code before the steam prompt loads properly. I encountered this problem after modifying the code to type user/pass (instead of -login parameter) to make steam save the password.
SAM missed the first 4 characters of my usernames there, after adding a 5-second delay, it worked. I think 500-1000 ms should be enough for 2fa popup.
Or we need an other reliable way to check if steam's prompt loaded completely.

Can just read titles of windows, and only paste if active window is active and if not wait for it.

Yeah would like that option too, to enter username/password too to make save account until next restart of steam.

from sam.

rex706 avatar rex706 commented on September 1, 2024

@gmmanonymus111 @wazerstar My original approach with SAM was to do what you suggest and enter the login fields manually somehow in order to get Steam to remember the last logged in account, but I ran into exactly what you're describing with the window not being fully initialized. I hesitate to just go the easy route with timers as that may still not handle every situation correctly if a user has a terribly slow PC and leaving users with too much time between actions probably isn't the right way to do it either.

I'm at work at the moment, but when I get home later today I will take another stab at coming up with a good way to make sure the windows are loaded fully before trying to enter any information. I will also consider making Steam shut down properly using the command instead of trying to end the task directly as this could be causing problems as you said.

I very much appreciate you both helping me out with this.

from sam.

rex706 avatar rex706 commented on September 1, 2024

@wazerstar @gmmanonymus111 I think I have figured out a nice way to wait for the Steam Guard window to be fully initialized and ready for input. I decided to go back and see if I can get this to work when logging in too, but the problem then becomes the previously logged in user already occupying the 'Account name' field, which makes the input cursor start on the password field. I am not sure if there is a way to tell if the 'Account name' field is actually occupied without checking the process memory, which I hesitate to want to do with something like Steam. The Shift+Tab combo will bring the cursor up to the 'Account name' field if it starts on 'Password', but again there doesn't seem to be a nice way to know that is where it started. I am also now using the -shutdown command so hopefully that process will go more smoothly.

I'll push a commit soon so you can see what I'm talking about.

from sam.

wazerstar avatar wazerstar commented on September 1, 2024

@wazerstar @gmmanonymus111 I think I have figured out a nice way to wait for the Steam Guard window to be fully initialized and ready for input. I decided to go back and see if I can get this to work when logging in too, but the problem then becomes the previously logged in user already occupying the 'Account name' field, which makes the input cursor start on the password field. I am not sure if there is a way to tell if the 'Account name' field is actually occupied without checking the process memory, which I hesitate to want to do with something like Steam. The Shift+Tab combo will bring the cursor up to the 'Account name' field if it starts on 'Password', but again there doesn't seem to be a nice way to know that is where it started. I am also now using the -shutdown command so hopefully that process will go more smoothly.

I'll push a commit soon so you can see what I'm talking about.

Will u compile > release too? :D

from sam.

rex706 avatar rex706 commented on September 1, 2024

@wazerstar I will definitely make another release after I run some more tests on a few more slower devices and confirm what I came up with works.

Maybe @gmmanonymus111 can test it out too and see if they can get logged in consistently?

from sam.

gmmanonymus111 avatar gmmanonymus111 commented on September 1, 2024

from sam.

gmmanonymus111 avatar gmmanonymus111 commented on September 1, 2024

@rex706 I finally got time to test it, but sadly it doesn't work as it should be. First login is ok, then the second/third etc will hang because of a wrong auth code (SAM detects the popup, but for some reason, it types instantly, like WaitForInputIdle wasn't even there. I'm not sure about slow PCs, though.

from sam.

rex706 avatar rex706 commented on September 1, 2024

@gmmanonymus111 Yeah I was having the same issue unfortunately. The first login attempt works fine, but every time after that without restarting SAM does not work as if it completely ignores the wait function like you said.

I will check out your pull request and see if that solves the problem!

from sam.

rex706 avatar rex706 commented on September 1, 2024

It auto closed the issue when I merged the code.

@gmmanonymus111 Frustratingly, this doesn't seem to work for me every time. The super weird part is that even though I can clearly see SAM typing in the code well after the window has been fully loaded, it still gives me the Sorry that wasn't quite right error, but not always.

Now I'm waiting how ever long Steam makes you wait for too many incorrect log in attempts.

Maybe the codes it is entering have expired at the last second? But that wouldn't make sense since it generates a completely fresh one only a few seconds later to still fail.

I really can't figure out why it would work every time the first try, but not any other attempt after until SAM is restarted. This makes me think some memory isn't being freed correctly, but most, if not all, variables used in that process are generated fresh anyway. Restarting SAM every login is an option, but that feels hacky.

I'll just have to take more time troubleshooting this.

from sam.

rex706 avatar rex706 commented on September 1, 2024

@gmmanonymus111 Oddly enough, using the regular GenerateSteamGuardCode() instead of the one that uses a time input fixes the problem I was having with the incorrect codes. It works every time I have tested without fail so far. Is there a specific reason you decided to use this one over the default one?

I'm still trying to figure out how to fix the problem of not waiting for the 2FA window unless SAM is reset. It literally waits fine every time if restarted even if Steam is open, so it has to be something in the code.

Edit:
Worst case scenario I can make a release with this fix, since it still works with the new waiting method, but I really want to get this done the right way if possible. The only problem I can think of currently is since it fails one login attempt almost every time after the first use, users run the risk of locking themselves out switching back and fourth too quickly. While this is just user error in most cases, who knows what everyone uses this for.

Edit 2:
Alright I decided sleeping the thread is fine for now unless more people complain it doesn't work. I can get this new system to work consistently by just sleeping the thread for 1000 ms after waiting for idle, even on slower systems. The first time a code is generated, you can see in the console that it prints that it is loading SteamAuth and Newtonsoft.Json, which is probably causing the slight wait between entering the code the first time since every login attempt after does not print those loading messages.

I will most likely be pushing a new commit and update soon.

from sam.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.