How can i pass 2FA authentification? #325
-
Hello. For now every run of the script requires 2FA steam guard code. It makes the use of the script impossible. Because obviously i want to use it in backgroud with the possibility of autorestarts. Some additionals, I already get secret_share and identify_secret. How can i use it in this lib to pass 2FA ? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 12 replies
-
There are two options:
from steam.client import SteamClient
from steam.guard import SteamAuthenticator
client = SteamClient()
client.set_credential_location('./secrets_directory')
code = SteamAuthenticator(secrets={"shared_secret": "...."}).get_code()
client.login(username, password, two_factor_code=code)
# first login
client1 = SteamClient()
client1.set_credential_location('.')
client1.cli_login()
if not client1.relogin_available:
client1.wait_event(EMsg.ClientNewLoginKey)
# save credentials for future logins
relogin_credentials = client1.username, client1.login_key
# second login (for example, reconnecting after being disconnected)
client1.disconnect()
client1.relogin() # uses username and login_key
# third login (login after a while)
client2 = SteamClient()
client2.set_credential_location('.')
client2.username, client2.login_key = relogin_credentials
client2.relogin() Example from |
Beta Was this translation helpful? Give feedback.
-
Thx a lot! The first way looks slightly better. Do i really need the row with credentials? Looks like steam auth code is all i need :) |
Beta Was this translation helpful? Give feedback.
-
Am I missing something? client = SteamClient()
userdata = Path(USER_FILE)
if userdata.is_file():
# read the data, populate SteamClient instance with user and login_key
result = client.relogin()
print(result)
else:
client.cli_login() Always returns LOGONDENIED. |
Beta Was this translation helpful? Give feedback.
-
How do I properly do re-login when steam rejects my sentry data? client = SteamClient()
client.credential_location = '.'
userdata = Path(USER_FILE)
result = None
if userdata.is_file():
f = open(USER_FILE, 'r', encoding='utf-8')
client.username = f.readline().strip().rstrip('\n')
client.login_key = f.readline().strip().rstrip('\n')
f.close()
result = client.relogin()
#print(result)
else:
client.cli_login()
if not client.relogin_available:
client.wait_event(EMsg.ClientNewLoginKey) the example says I need to wait for |
Beta Was this translation helpful? Give feedback.
There are two options:
SteamAuthenticator
and generate a 2FA for every loginlogin_key
(Steam remember password feature)