Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

re-write webauth implementation for steam backend changes #453

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

Open
aUniqueUser wants to merge 1 commit into ValvePython:master
base: master
Choose a base branch
Loading
from aUniqueUser:webauth-2

Conversation

@aUniqueUser
Copy link

@aUniqueUser aUniqueUser commented Oct 24, 2023

login/dologin/ was borked by valve, pr addresses issue by using the new login system

todo:

  • steam email/mobile guard support
  • replace WebAuth class with WebAuth2 class

pawelk1337 reacted with thumbs up emoji
Copy link
Author

aUniqueUser commented Oct 24, 2023
edited
Loading

resolves #451 #450 after completion.
#452 will need to be looked into, anyone welcome to contribute.

Copy link

negstek commented Oct 24, 2023
edited
Loading

@aUniqueUser I gave a try with your code but it does not work. I tried this:

user = wa.WebAuth2(STEAM_BOT_NAME)
steam_session = user.login(STEAM_BOT_PASSWORD)
item_name="AK-47 | Aquamarine Revenge (Factory New)"
url = f"https://steamcommunity.com/market/pricehistory/?appid=730&market_hash_name={item_name}"
 
request = steam_session.get(url)
result = json.loads(request.text)
print(result)

but I get this exception:
, line 144, in _startSessionWithCredentials self.clientID = r['response']['client_id'] ~~~~~~~~~~~~~^^^^^^^^^^^^^ KeyError: 'client_id'
response is empty except for interval argument:

r = {'response': {'interval': 5, 'extended_error_message': ''}}

Copy link

negstek commented Oct 24, 2023
edited
Loading

Forget about my previous answer, you changed a bit the behavior of the login method so my legacy code failed but after a deeper look into your code it works fine using login with username and password attributes

user = wa.WebAuth2()
steam_session = user.login(STEAM_BOT_NAME, STEAM_BOT_PASSWORD)
item_name="AK-47 | Aquamarine Revenge (Factory New)"
url = f"https://steamcommunity.com/market/pricehistory/?appid=730&market_hash_name={item_name}"
 
request = steam_session.get(url)
result = json.loads(request.text)
print(result)

works fine, thank you very much for your help.

Copy link
Author

Yea before final merge I will need to correct it to work better with legacy code, good to see it working though 👍

'platform_type': '2',
'persistence': '1',
'website_id': 'Community'
}, 'IAuthentication', 'BeginAuthSessionViaCredentials', 1)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since I use the steam authenticator app I added support for it by adding the following lines here at line 144:

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

and of course adding sleep to the import at row 58.

If you reply to the authentication before the _pollLoginStatus the login will continue as normal.

Copy link
Author

@aUniqueUser aUniqueUser Oct 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the info, ill full implement when i get some time and will add email auth aswell. Need to figure out what 'guard_data' is in here https://steamapi.xpaw.me/#IAuthenticationService/BeginAuthSessionViaCredentials

Copy link

Has anyone figured out how to add email authentication to this.

Copy link

Has anyone figured out how to add email authentication to this.

Yeah. I will write some staff into codebase and add pull request (about 1 day) mayble sooner, but it's 3 AM for me

aUniqueUser, Revibess, and VitorOriel reacted with thumbs up emoji

Copy link

Has anyone figured out how to add email authentication to this.

Yeah. I will write some staff into codebase and add pull request (about 1 day) mayble sooner, but it's 3 AM for me

No worries, take your time.

Copy link

I added

Has anyone figured out how to add email authentication to this.

Yeah. I will write some staff into codebase and add pull request (about 1 day) mayble sooner, but it's 3 AM for me

No worries, take your time.

I added some changes, and will add MUCH more later. you can check them out in another PR: #454

marv1n91 pushed a commit to marv1n91/tm-steambot that referenced this pull request Jan 9, 2026
Replace deprecated steampy with ValvePython/steam which supports
Steam's new protobuf-based authentication API.
Changes:
- Add new steam_client_new.py using steam.webauth for login
- Uses steam.guard.generate_twofactor_code for 2FA
- Makes direct HTTP requests to Steam Market API (like Node.js version)
- Maintains same interface as old steampy implementation
- Add test_steam_new.py for testing new authentication
- Update requirements.txt: replace steampy with steam[client]>=1.4.4
- Add STEAM_AUTH_FIX.md with detailed migration instructions
Technical approach:
1. Use WebAuth from ValvePython/steam for login (works with new API)
2. Generate 2FA codes from shared_secret
3. Get authenticated session with cookies
4. Make direct POST/GET requests to Steam Market endpoints
This fixes the 'refresh_token' KeyError that occurs with steampy 1.1.0
on Steam's new authentication system.
Based on:
- ValvePython/steam PR #453, #454 (WebAuth rewrite for new Steam API)
- Node.js buyOrders.js implementation provided by user
- Hybrid approach: steam auth + HTTP requests
Refs:
- bukson/steampy#377
- ValvePython/steam#453 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer

@emipa606 emipa606 emipa606 left review comments

Reviewers whose approvals may not affect merge requirements

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /