Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Steam login error #43

Closed
Nionor opened this issue Nov 10, 2023 · 23 comments
Closed

Steam login error #43

Nionor opened this issue Nov 10, 2023 · 23 comments

Comments

@Nionor
Copy link

Nionor commented Nov 10, 2023

Just a heads up, the WebAuth class from steam is not working, it is know ValvePython/steam#450

I solved it by editing the the webauth.py file and some small changes to this script but I would recommend waiting for an official steam update.

@sizzleweet
Copy link

Just a heads up, the WebAuth class from steam is not working, it is know ValvePython/steam#450

I solved it by editing the the webauth.py file and some small changes to this script but I would recommend waiting for an official steam update.

Can you share the edits you made? Haven't seen an update or a response to your issue.

Thanks!

@Nionor
Copy link
Author

Nionor commented Dec 8, 2023

Sure, I use the code from here and added the sleep that was commented in there just so you have time to react with steam guard. You need to import sleep also on row 58 from time import time, sleep

Then I changed steam_login() in humblesteamkeysredeemer.py so it looks like this.

def steam_login():
    # Sign into Steam web

    # Attempt to use saved session
    r = requests.Session()
    if try_recover_cookies(".steamcookies", r) and verify_logins_session(r)[1]:
        return r

    # Saved state doesn't work, prompt user to sign in.
    s_username = input("Steam Username: ")
    s_psw = input("Steam Password: ")
    user = wa.WebAuth2()
    session = user.login(s_username, s_psw)
    export_cookies(".steamcookies", session)
    return session

@sizzleweet
Copy link

sizzleweet commented Dec 11, 2023

Sure, I use the code from here and added the sleep that was commented in there just so you have time to react with steam guard. You need to import sleep also on row 58 from time import time, sleep

So you just added this @ line 144? Overwriting it, or just adding it there?

if "allowed_confirmations" in r['response']:
            print("Respond to steam guard within 10 seconds")
            sleep(10)

and obviously the import section too

@Nionor
Copy link
Author

Nionor commented Dec 11, 2023

yup, just adding, _startSessionWithCredentials should look like this.

    def _startSessionWithCredentials(self, sAccountEncryptedPassword, iTimeStamp):
        r = sendAPIRequest(
            {'device_friendly_name': self.userAgent,
             'account_name': self.username,
             'encrypted_password': sAccountEncryptedPassword,
             'encryption_timestamp': iTimeStamp,
             'remember_login': '1',
             'platform_type': '2',
             'persistence': '1',
             'website_id': 'Community'
             }, 'IAuthentication', 'BeginAuthSessionViaCredentials', 1)

        if "allowed_confirmations" in r['response']:
            print("Respond to steam guard within 10 seconds")
            sleep(10)

        self.clientID = r['response']['client_id']
        self.requestID = r['response']['request_id']
        self.steam_id = SteamID(r['response']['steamid'])

@sizzleweet
Copy link

yup, just adding, _startSessionWithCredentials should look like this.

I think I'm missing a step, my webauth.py doesn't even have that function at all. I know I'm running 1.4.4 of the module...

@Nionor
Copy link
Author

Nionor commented Dec 11, 2023

Oh but have you added the whole WebAuth2 part?

@sizzleweet
Copy link

sizzleweet commented Dec 11, 2023 via email

@Nionor
Copy link
Author

Nionor commented Dec 11, 2023

Just take the whole file from here and add the sleep part to it.

@sizzleweet
Copy link

sizzleweet commented Dec 11, 2023 via email

@Xarin
Copy link

Xarin commented Dec 15, 2023

Thanks @Nionor you got me up and working as well!

@Astreo80
Copy link

@Nionor I got the humble login to work but once i get to steam i've had two experiences. Either it asks me for my 2FA code and then says "press enter to exit console" or it doesnt ask for my code and then just says the same thing. Any ideas?

@Nionor
Copy link
Author

Nionor commented Dec 19, 2023

@Astreo80 did you try with the new WebAuth class that was talked about here above?

@Astreo80
Copy link

@Astreo80 did you try with the new WebAuth class that was talked about here above?

Thart part im not sure. I downlaoded the file you linked, added the lines you said but i dont know what to do with that after.

@Nionor
Copy link
Author

Nionor commented Dec 19, 2023

@Astreo80 Ok, well that should be enough, did you change the parts in humblesteamkeysredeemer.py too?
If it's using the new class it shouldn't ask for 2FA but instead just wait for you to verify on your phone or similar.

@Astreo80
Copy link

@Astreo80 Ok, well that should be enough, did you change the parts in humblesteamkeysredeemer.py too? If it's using the new class it shouldn't ask for 2FA but instead just wait for you to verify on your phone or similar.

Sorry i didnt make myself clear. i did edit both files. I have the WebAuth file edited as you said but its just sitting in the same folder as the redeemer. Do i run it somewhere or put in in a folder? the redeemer has only ever asked me for the 2FA, never prompted me to just hit yes or accept on steamguard.

@Nionor
Copy link
Author

Nionor commented Dec 19, 2023

@Astreo80 Oh ya that's the problem then, the WebAuth file need to be where the original is, that depends a bit how you have python installed and what OS you are on.

@Astreo80
Copy link

@Astreo80 Oh ya that's the problem then, the WebAuth file need to be where the original is, that depends a bit how you have python installed and what OS you are on.

I installed it with windows 10 and regular C drive location.

@Nionor
Copy link
Author

Nionor commented Dec 19, 2023

Then it should be in %appdata%\Python\Python38\site-packages\steam
Make a copy of the original and paste in the new one there.

@Astreo80
Copy link

Then it should be in %appdata%\Python\Python38\site-packages\steam Make a copy of the original and paste in the new one there.

I think i made it worse. Now when i run the bat it says "no module named steam.webauth.

@Nionor
Copy link
Author

Nionor commented Dec 20, 2023

I think i made it worse. Now when i run the bat it says "no module named steam.webauth.

Not sure what you managed then, seems like the webauth.py file is missing/corrupt.

@zankaku
Copy link

zankaku commented Dec 26, 2023

Thanks for the comments here, I also got it to work.

Here are the steps as I did them:

1. New webauth

2. Edit webauth.py

  • Line 54: Add import for sleep
    from time import time, sleep

  • Line 133: Replace function _startSessionWithCredentials

   def _startSessionWithCredentials(self, sAccountEncryptedPassword, iTimeStamp):
        r = sendAPIRequest(
            {'device_friendly_name': self.userAgent,
             'account_name': self.username,
             'encrypted_password': sAccountEncryptedPassword,
             'encryption_timestamp': iTimeStamp,
             'remember_login': '1',
             'platform_type': '2',
             'persistence': '1',
             'website_id': 'Community'
             }, 'IAuthentication', 'BeginAuthSessionViaCredentials', 1)
        
        if "allowed_confirmations" in r['response']:
            print("Respond to steam guard within 10 seconds")
            sleep(10)

        self.clientID = r['response']['client_id']
        self.requestID = r['response']['request_id']
        self.steam_id = SteamID(r['response']['steamid'])

3. Edit humblesteamkeysredeemer.py

  • Line 5: Replace webauth import with local file
    import webauth as wa

  • Line 321: Replace function steam_login

def steam_login():
    # Sign into Steam web

    # Attempt to use saved session
    r = requests.Session()
    if try_recover_cookies(".steamcookies", r) and verify_logins_session(r)[1]:
        return r

    # Saved state doesn't work, prompt user to sign in.
    s_username = input("Steam Username: ")
    s_psw = input("Steam Password: ")
    user = wa.WebAuth2()
    session = user.login(s_username, s_psw)
    export_cookies(".steamcookies", session)
    return session

Done :)

(If you are not familiar with Python, make sure everything has correct indentation.

@Astreo80 maybe you want to try again :)?

@Astreo80
Copy link

Thanks for the comments here, I also got it to work.

Here are the steps as I did them:

1. New webauth

* Download the new webauth file from: https://github.com/ValvePython/steam/blob/9b8eb33b4793b2c6cfcd2601e8b538065701b6ff/steam/webauth.py

* Put new webauth file next to `humblesteamkeysredeemer.py`

2. Edit webauth.py

* Line 54: Add import for sleep
  `from time import time, sleep`

* Line 133: Replace function `_startSessionWithCredentials`
   def _startSessionWithCredentials(self, sAccountEncryptedPassword, iTimeStamp):
        r = sendAPIRequest(
            {'device_friendly_name': self.userAgent,
             'account_name': self.username,
             'encrypted_password': sAccountEncryptedPassword,
             'encryption_timestamp': iTimeStamp,
             'remember_login': '1',
             'platform_type': '2',
             'persistence': '1',
             'website_id': 'Community'
             }, 'IAuthentication', 'BeginAuthSessionViaCredentials', 1)
        
        if "allowed_confirmations" in r['response']:
            print("Respond to steam guard within 10 seconds")
            sleep(10)

        self.clientID = r['response']['client_id']
        self.requestID = r['response']['request_id']
        self.steam_id = SteamID(r['response']['steamid'])

3. Edit humblesteamkeysredeemer.py

* Line 5: Replace webauth import with local file
  `import webauth as wa`

* Line 321: Replace function `steam_login`
def steam_login():
    # Sign into Steam web

    # Attempt to use saved session
    r = requests.Session()
    if try_recover_cookies(".steamcookies", r) and verify_logins_session(r)[1]:
        return r

    # Saved state doesn't work, prompt user to sign in.
    s_username = input("Steam Username: ")
    s_psw = input("Steam Password: ")
    user = wa.WebAuth2()
    session = user.login(s_username, s_psw)
    export_cookies(".steamcookies", session)
    return session

Done :)

(If you are not familiar with Python, make sure everything has correct indentation.

@Astreo80 maybe you want to try again :)?

This got it working! Not only did i realize i moved the web.auth file away from the redeemer but it got the steamguard working. thank you!

@FailSpy
Copy link
Owner

FailSpy commented Feb 26, 2024

Hi there all! I've made a fork of the steam python library that implements the relevant fixes here and makes it a little better integrated with Steam Auth. You can use email codes, device codes, OR device-based authentication (approve/deny on Steam app)

I do want to add QR codes, mostly for the fun of it, as well as making people feel more confident in logging in (you directly get an authentication token, no credentials required), but that's later down the line.

You can find it here at https://github.com/FailSpy/steam-py-lib

I've also made requirements.txt use that repo instead, so if you do pip install -r requirements.txt it will automatically clone and use that repo's version. It seems like ValvePython/steam may well be abandoned, so until further notice or someone takes over to make a functional fork for this repo's needs, I'm going to continue having people use my patched version of Steam.

If you run into issues, if it seems like an issue with the Steam login specifically, rather than this repo's particular functionality, it would be great if they could be filed to my forked repo just to have the separation and to refer people to where the issue actually lies.

@FailSpy FailSpy closed this as completed Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants