Files
stack/sdks/implementations/python
Ejiro Asiuwhu 6b1138981d feat: add token store with CAS-based refresh and dual locks
- TokenStore ABC with get_stored_access_token, get_stored_refresh_token, compare_and_set
- MemoryTokenStore, ExplicitTokenStore, RequestTokenStore implementations
- Module-level registry shares MemoryTokenStore instances per project_id
- resolve_token_store handles memory/dict/request/None init variants
- CAS refresh algorithm (sync + async) with 20s expiry buffer and 75s iat threshold
- Token refresh via form-encoded POST to /api/v1/auth/oauth/token
- Per-instance threading.Lock and asyncio.Lock for concurrency safety
- 34 passing tests covering all store types, registry, helpers, and CAS branches
2026-03-25 00:51:40 +01:00
..

Stack Auth Python SDK

Python SDK for Stack Auth - authentication, user management, and team management for your Python backend.

Installation

pip install stack-auth

Quick Start

from stack_auth import StackServerApp

app = StackServerApp(
    project_id="your-project-id",
    secret_server_key="your-secret-key",
)

# Verify a request's access token
user = await app.authenticate_request(request)

Requirements

  • Python 3.10+