Steam login error
Closed this issue · 23 comments
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.
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!
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
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
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'])
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...
Oh but have you added the whole WebAuth2 part?
@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?
@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.
@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 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.
@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 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.
Then it should be in %appdata%\Python\Python38\site-packages\steam
Make a copy of the original and paste in the new one there.
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.
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.
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 :)?
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!
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.