Skip to content

🔐 py-jwt — JWT Authentication Library

Doc model: This wiki describes the runtime, architectural, and integration behavior of jwtlib — the pure, framework-agnostic JWT authentication logic powering service auth. For the full API reference and machine-readable surface, see the Library and MCP tabs.

jwtlib provides pure logic components for user registration, login, token introspection, and authentication verification. It has no web-framework dependencies: FastAPI, Flask, or plain asyncio apps can use the same coroutine-based API.


🚀 Key Features

  • Pure logic, any framework — no FastAPI/Flask coupling; drop it into any async application.
  • Token introspection — verify any JWT and resolve its user without static sessions or a shared session store.
  • Request authentication — logic-only authenticate_request guard for the callers that need an authorization decision.
  • Pluggable persistenceUserRepository is injected; ship the provided MongoDB-backed default or implement your own.
  • Typed end to end — Pydantic request/response models for every operation, with full .pyi stubs published for consumers.

⚡ Quick Start

1
2
3
4
5
6
7
8
9
import asyncio
from jwtlib import login_user, LoginRequest

async def main():
    response = await login_user(LoginRequest(username="admin", password="password"))
    print(response.access_token)
    print(response.user.username)

asyncio.run(main())

See How to Use for registration, session checks, and introspection flows.


📖 Documentation Structure

Section Description
Overview Architecture, layers, and public API surface
How to Use Register, login, session lookup, logout, introspection
Framework Integration Wiring jwtlib into FastAPI and resource servers
Development Setup, tests, and docforge build

The reference implementations of these skills live in the auth-server service.



© Aetoskia Internal — py-jwt 0.0.4