Skip to main content

xbl3auth

Security-conscious helper library and CLI for obtaining XBL3.0 tokens for Xbox Live.

  • Uses official Microsoft auth (MSAL) instead of scraping login pages.
  • Never handles raw passwords: relies on browser/OS for sign-in.
  • Stores refresh tokens in the OS keyring (Credential Manager, Keychain, etc.).
  • Keeps XBL3.0 tokens in memory by default, printing to stdout when requested.
  • Ships with a built-in public client ID and a remote config endpoint for rotation.

This library is for legitimate use with accounts you control. Respect Microsoft ToS and local laws.

Installation

poetry add xbl3auth
# or
pip install xbl3auth

CLI usage

The CLI uses, in order of precedence:

  1. --client-id flag
  2. XBL3AUTH_CLIENT_ID environment variable
  3. Remote config endpoint
  4. Built-in default client ID

Basic usage:

python -m xbl3auth

This will:

  1. Resolve the effective client ID.
  2. Start a device code flow (you sign in in a browser).
  3. Store a refresh token in your OS keyring.
  4. Fetch an XBL3.0 token and print it to stdout:
XBL3.0 x=<uhs>;<token>

Overriding the client ID

If advanced users want to supply their own Azure app registration:

  1. Command-line flag
python -m xbl3auth --client-id "<your-azure-client-id>"
  1. Environment variable
export XBL3AUTH_CLIENT_ID="<your-azure-client-id>"
python -m xbl3auth

JSON output

python -m xbl3auth --print-json

Library usage

from xbl3auth import XblAuthConfig, Xbl3AuthService

config = XblAuthConfig()  # uses remote/built-in client_id by default
service = Xbl3AuthService(config, account_id="default")

xbl3_token = service.get_xbl3_token()
print(xbl3_token)

To use a custom client ID:

config = XblAuthConfig(client_id="<your-client-id>")

Security model

  • No credential files: No email:password lists, no plaintext token dumps by default.
  • Keyring-backed: Refresh tokens are stored in the OS keyring:
    • Windows Credential Manager
    • macOS Keychain
    • GNOME Keyring / KWallet (depending on environment)
  • Short-lived tokens: XBL3.0 tokens are treated as in-memory, ephemeral values.
  • Logging discipline: Library is designed so callers can log error metadata without leaking secrets.

Testing

poetry install
poetry run pytest

Tests:

  • Use an in-memory secret storage backend.
  • Monkeypatch HTTP requests to avoid real network calls.
  • Avoid touching the real keyring.

Metadata

Release files for xbl3auth 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xbl3auth 0.1.0
File Size Uploaded
xbl3auth-0.1.0.tar.gz 11.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for xbl3auth 0.1.0
File Interpreter ABI Platform
xbl3auth-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 26.5 kB

Release files / xbl3auth-0.1.0.tar.gz

Download URL xbl3auth-0.1.0.tar.gz
Size 11.0 kB
Tags Source
SHA-256 checksum
How to use checksums
94b7532d9725254c508c668c127b9bdda64883a48ad1c789077f97a33537cd45
BLAKE2b-256 checksum
How to use checksums
bc3909dc712cc0117d7a76f023b8a8b79faa0656266c0f7814dbf9d33fe4fee5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.12.11 Windows/11

Release files / xbl3auth-0.1.0-py3-none-any.whl

Download URL xbl3auth-0.1.0-py3-none-any.whl
Size 15.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ad9262d9eb0e7bff2d99eee36523b8f600a66dfb910a1066de86e17e28a5221c
BLAKE2b-256 checksum
How to use checksums
1af0556160ccd9d41d953bbc5ae4c95ee2a40764bcf80e21ae6e06281c111a80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.12.11 Windows/11

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page