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:
--client-idflagXBL3AUTH_CLIENT_IDenvironment variable- Remote config endpoint
- Built-in default client ID
Basic usage:
python -m xbl3auth
This will:
- Resolve the effective client ID.
- Start a device code flow (you sign in in a browser).
- Store a refresh token in your OS keyring.
- 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:
- Command-line flag
python -m xbl3auth --client-id "<your-azure-client-id>"
- 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:passwordlists, 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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| xbl3auth-0.1.0.tar.gz | 11.0 kB | Without provenance | Details for xbl3auth-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| xbl3auth-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for xbl3auth-0.1.0-py3-none-any.whl |
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
|
Security for xbl3auth 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.