Skip to content

[BUG] Login always fails when using access/refresh token #16

@LunaticWasTaken

Description

@LunaticWasTaken

Description
In the docs/file, it says you can login with refresh tokens.

If you have 2FA/SteamGuard, login first with :class:`WebAuth` then pass
        the WebAuth `refresh_token` as Client `access_token`.
        You can save the `username` and `refresh_token` somewhere for automatic
        login at a later time.

        Example:

        .. code:: python
            In [1]: import steam.client, steam.webauth
            In [2]: webauth = steam.webauth.WebAuth()
            In [3]: _ = webauth.cli_login('username')
            Enter password for 'username':
            Enter your Steam Guard code (or simply press Enter if approved via app):
            In [4]: client = steam.client.SteamClient()
            In [5]: client.login(webauth.username, access_token=webauth.refresh_token)
            Out[5]: <EResult.OK: 1>

However, it seems that this does not work at all, since using both the auth's refresh and access-token will fail.
e.g.

webauth = WebAuth(username= "CENSORED", password="CENSORED")
webauth.login()
# Check if auth was successful
print(webauth.steam_id)
client = SteamClient()
res = client.login(username=webauth.username, password=webauth.password)
# Check if login was successful
print(res)

prints the following:

7656119XXXXXXXXXX
EResult.OK

where the steamid is valid.

However, instead using

res = client.login(username=webauth.username, access_token=webauth.access_token)

causes a AccessDenied, and using the refresh-token causes InvalidPassword

Steps to Reproduce the behavior

  • See code above

Expected behavior
Logging in via either access or refresh token?

Screenshots
/

Versions Report

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

Dependencies:
C:\Users\luna\PycharmProjects\PROJECT_NAME\.venv\lib\site-packages\steam\versions_report\__init__.py:12: 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: 4.0
            protobuf: 5.29.5
            requests: 2.32.4
          cachetools: 6.1.0
              gevent: 25.5.1
 gevent-eventemitter: 2.1
       pycryptodomex: 3.23.0
              enum34: 1.1.10
       win-inet-pton: 1.1.0

Python runtime:
          executable: C:\Users\luna\PycharmProjects\PROJECT_NAME\.venv\Scripts\python.exe
             version: 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
            platform: win32

System info:
              system: Windows
             machine: AMD64
             release: 10
             version: 10.0.26100

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions