# steamcommunitykit/steam-protobuf-login architecture

> Architecture diagram of the GitHub repository steamcommunitykit/steam-protobuf-login, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/steamcommunitykit/steam-protobuf-login
- Repository: https://github.com/steamcommunitykit/steam-protobuf-login

## Overview

SteamLogin is a small Python library that performs Steam’s credential-based login, handles an optional Steam Guard prompt, polls for tokens, and can optionally exchange the refresh token for a web cookie. The same module also exposes a separate refresh-token flow. All implementation evidence comes from SteamAuth.py; README describes the outputs and Guard options.

Main entry points: [`SteamAuth.py`](https://github.com/steamcommunitykit/steam-protobuf-login/blob/main/SteamAuth.py) (Cookie exchange)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_user(("Library user"))
node_login["SteamLogin<br/>[SteamAuth.py]"]
node_session["Session setup<br/>[SteamAuth.py]"]
node_rsa["RSA parameters<br/>[SteamAuth.py]"]
node_begin["Begin login<br/>[SteamAuth.py]"]
node_guard["Guard handling<br/>[SteamAuth.py]"]
node_prompt(("Guard code"))
node_poll["Token polling<br/>[SteamAuth.py]"]
node_secure["Cookie exchange<br/>[SteamAuth.py]"]
node_refresh["Token refresh<br/>[SteamAuth.py]"]
node_community["Steam Community"]
node_authapi["Steam Auth API"]
node_finalize["Login finalizer"]
node_settoken["Community settoken"]
node_outputs["Tokens and cookies<br/>[SteamAuth.py]"]

node_user -->|"provides credentials"| node_login
node_login -->|"creates session"| node_session
node_session -->|"requests session ID"| node_community
node_login -->|"fetches key"| node_rsa
node_rsa -->|"gets RSA key"| node_authapi
node_login -->|"starts login"| node_begin
node_begin -->|"begins auth"| node_authapi
node_begin -->|"passes response"| node_guard
node_guard -->|"requests code"| node_prompt
node_prompt -->|"returns code"| node_guard
node_guard -->|"submits Guard code"| node_authapi
node_guard -->|"polls session"| node_poll
node_poll -->|"checks status"| node_authapi
node_poll -->|"stores tokens"| node_outputs
node_poll -.->|"optionally fetches cookie"| node_secure
node_secure -->|"exchanges refresh token"| node_finalize
node_finalize -->|"returns transfer data"| node_secure
node_secure -->|"sets web token"| node_settoken
node_settoken -->|"returns cookie"| node_secure
node_secure -->|"stores cookie"| node_outputs
node_user -->|"supplies refresh token"| node_refresh
node_refresh -->|"finalizes login"| node_finalize
node_refresh -->|"sets token"| node_settoken
node_refresh -->|"returns refreshed token"| node_outputs
node_login -->|"exposes session and results"| node_outputs

click node_login "https://github.com/steamcommunitykit/steam-protobuf-login/blob/main/SteamAuth.py"
click node_session "https://github.com/steamcommunitykit/steam-protobuf-login/blob/main/SteamAuth.py"
click node_rsa "https://github.com/steamcommunitykit/steam-protobuf-login/blob/main/SteamAuth.py"
click node_begin "https://github.com/steamcommunitykit/steam-protobuf-login/blob/main/SteamAuth.py"
click node_guard "https://github.com/steamcommunitykit/steam-protobuf-login/blob/main/SteamAuth.py"
click node_poll "https://github.com/steamcommunitykit/steam-protobuf-login/blob/main/SteamAuth.py"
click node_secure "https://github.com/steamcommunitykit/steam-protobuf-login/blob/main/SteamAuth.py"
click node_refresh "https://github.com/steamcommunitykit/steam-protobuf-login/blob/main/SteamAuth.py"
click node_outputs "https://github.com/steamcommunitykit/steam-protobuf-login/blob/main/SteamAuth.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_user toneBlue
class node_login,node_session,node_rsa,node_begin,node_guard,node_poll,node_secure,node_refresh,node_outputs toneTeal
class node_prompt,node_community,node_finalize,node_settoken toneIndigo
class node_authapi toneMint
```

## Components

### Other components

- **Library user**
- [SteamLogin](https://github.com/steamcommunitykit/steam-protobuf-login/blob/main/SteamAuth.py): `SteamAuth.py`
- [Session setup](https://github.com/steamcommunitykit/steam-protobuf-login/blob/main/SteamAuth.py): `SteamAuth.py`
- [RSA parameters](https://github.com/steamcommunitykit/steam-protobuf-login/blob/main/SteamAuth.py): `SteamAuth.py`
- [Begin login](https://github.com/steamcommunitykit/steam-protobuf-login/blob/main/SteamAuth.py): `SteamAuth.py`
- [Guard handling](https://github.com/steamcommunitykit/steam-protobuf-login/blob/main/SteamAuth.py): `SteamAuth.py`
- **Guard code**
- [Token polling](https://github.com/steamcommunitykit/steam-protobuf-login/blob/main/SteamAuth.py): `SteamAuth.py`
- [Cookie exchange](https://github.com/steamcommunitykit/steam-protobuf-login/blob/main/SteamAuth.py): `SteamAuth.py`
- [Token refresh](https://github.com/steamcommunitykit/steam-protobuf-login/blob/main/SteamAuth.py): `SteamAuth.py`
- **Steam Community**
- **Steam Auth API**
- **Login finalizer**
- **Community settoken**
- [Tokens and cookies](https://github.com/steamcommunitykit/steam-protobuf-login/blob/main/SteamAuth.py): `SteamAuth.py`

## Connections

- Library user → SteamLogin: provides credentials
- SteamLogin → Session setup: creates session
- Session setup → Steam Community: requests session ID
- SteamLogin → RSA parameters: fetches key
- RSA parameters → Steam Auth API: gets RSA key
- SteamLogin → Begin login: starts login
- Begin login → Steam Auth API: begins auth
- Begin login → Guard handling: passes response
- Guard handling → Guard code: requests code
- Guard code → Guard handling: returns code
- Guard handling → Steam Auth API: submits Guard code
- Guard handling → Token polling: polls session
- Token polling → Steam Auth API: checks status
- Token polling → Tokens and cookies: stores tokens
- Token polling → Cookie exchange: optionally fetches cookie
- Cookie exchange → Login finalizer: exchanges refresh token
- Login finalizer → Cookie exchange: returns transfer data
- Cookie exchange → Community settoken: sets web token
- Community settoken → Cookie exchange: returns cookie
- Cookie exchange → Tokens and cookies: stores cookie
- Library user → Token refresh: supplies refresh token
- Token refresh → Login finalizer: finalizes login
- Token refresh → Community settoken: sets token
- Token refresh → Tokens and cookies: returns refreshed token
- SteamLogin → Tokens and cookies: exposes session and results
