mirror of
https://github.com/stack-auth/stack.git
synced 2026-07-20 21:29:36 +08:00
- 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
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+