Skip to main content

Security-conscious XBL3.0 token helper using MSAL and the OS keyring.

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xbl3auth-0.1.0.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xbl3auth-0.1.0-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

Details for the file xbl3auth-0.1.0.tar.gz.

File metadata

  • Download URL: xbl3auth-0.1.0.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.11 Windows/11

File hashes

Hashes for xbl3auth-0.1.0.tar.gz
Algorithm Hash digest
SHA256 94b7532d9725254c508c668c127b9bdda64883a48ad1c789077f97a33537cd45
MD5 c471eb579dc5ba260f91b0bbb537e264
BLAKE2b-256 bc3909dc712cc0117d7a76f023b8a8b79faa0656266c0f7814dbf9d33fe4fee5

See more details on using hashes here.

File details

Details for the file xbl3auth-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: xbl3auth-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.11 Windows/11

File hashes

Hashes for xbl3auth-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ad9262d9eb0e7bff2d99eee36523b8f600a66dfb910a1066de86e17e28a5221c
MD5 731ea558f084cd41c709f24c129be9bc
BLAKE2b-256 1af0556160ccd9d41d953bbc5ae4c95ee2a40764bcf80e21ae6e06281c111a80

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page