Skip to content

[BUG] Can't login with password despite it being correct #23

Description

@SyberiaK

Description
Trying to SteamClient.login(username="...", password="...") keeps failing with EResult.InvalidPassword. However, logging in through official Steam client with the same username and password works just fine.
Tried with two different accounts on two different machines from different IPs, no Steam Guard on either of those accounts.

Steps to Reproduce the behavior

from steam.client import SteamClient

import config  # env

class PatchedSteamClient(SteamClient):
    """Fixes an infinite program blocking when unable to connect to CM."""

    def _pre_login(self):
        if self.logged_on:
            raise RuntimeError("Already logged on")

        if not self.connected and not self._connecting:
            if not self.connect(retry=10):  # the only change made compared to parent
                return EResult.Fail

        if not self.channel_secured:
            resp = self.wait_event(self.EVENT_CHANNEL_SECURED, timeout=10)

            # some CMs will not send hello
            if resp is None:
                if self.connected:
                    self.wait_event(self.EVENT_DISCONNECTED)
                return EResult.TryAnotherCM

        return EResult.OK

client = PatchedSteamClient()
client.set_credential_location("somepath")

async def main():
    print('Logging in...')
    result = client.login(username=config.STEAM_USERNAME, password=config.STEAM_PASS)

    if result != EResult.OK:
        print(f"Failed to login: {result!r}")
        sys.exit(1)

    print('Logged in successfully.')
    client.run_forever()

if __name__ == '__main__':
    asyncio.run(main())

Expected behavior

Logging in...
Logged in successfully.

Screenshots
If applicable, add screenshots to help explain your problem.

Versions Report

python -m steam.versions_report (Run python -m steam.versions_report and paste the output below)
steam: 2.2.0

Dependencies:
C:\Users\syb\projects\myproject\.venv\Lib\site-packages\steam\versions_report\__init__.py:13: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
  import pkg_resources
                 vdf: 3.4
            protobuf: 3.20.3
            requests: 2.34.2
          cachetools: 6.2.6
              gevent: 24.2.1
 gevent-eventemitter: 2.1
       pycryptodomex: 3.23.0
              enum34: Not Installed
       win-inet-pton: Not Installed

Python runtime:
          executable: C:\Users\syb\projects\myproject\.venv\Scripts\python.exe
             version: 3.12.10 (tags/v3.12.10:0cc8128, Apr  8 2025, 12:21:36) [MSC v.1943 64 bit (AMD64)]
            platform: win32

System info:
              system: Windows
             machine: AMD64
             release: 11
             version: 10.0.26200

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions