Quickstart
Install
Section titled “Install”uv add lexigram-authMinimal Setup — AuthModule
Section titled “Minimal Setup — AuthModule”The quickest way to add authentication is through AuthModule.configure():
import asynciofrom lexigram import Applicationfrom lexigram.auth import AuthModulefrom lexigram.auth.config import AuthConfig, JWTConfig
async def main(): config = AuthConfig( secret_key="your-256-bit-secret-here-must-be-long", token=JWTConfig(secret_key="your-256-bit-secret-here-must-be-long"), )
async with Application.boot( name="my-app", modules=[AuthModule.configure(config=config)], ) as app: print(f"App running: {app.state}")
asyncio.run(main())Using AuthBundleProvider Directly
Section titled “Using AuthBundleProvider Directly”When you’re wiring providers explicitly (Pattern 2), use AuthBundleProvider:
from lexigram import Applicationfrom lexigram.auth import AuthBundleProviderfrom lexigram.auth.config import AuthConfig
def create_app() -> Application: app = Application(name="my-app") app.add_provider(AuthBundleProvider( config=AuthConfig(secret_key="your-secret-key"), )) return appTesting with AuthModule.stub()
Section titled “Testing with AuthModule.stub()”For unit tests, use the in-memory stub to avoid external dependencies:
from lexigram.auth import AuthModule
# Returns a DynamicModule backed by ephemeral in-memory storagetest_module = AuthModule.stub()Next Steps
Section titled “Next Steps”- Guide — authentication, authorization, and token management workflows
- How-Tos — JWT, RBAC, OAuth2 recipes
- Configuration — all configuration keys