Registry / auth-security / authx
library1.7.0pypypi✓ verified 88d ago

Ready-to-use and customizable authentication and OAuth2 management for FastAPI. Provides JWT, session, rate limiting, and scope management. Current version 1.6.0, requires Python >=3.9, rapid releases.

pip install authx
INSTALL
IMPORT
SIG · AUTHX
A
authx
auth-securitypythonv1.7.0
Install
5.2s avg
Import
1567ms
Disk
52MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v1.7.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 1.644s · 53.3MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 5.2s · import 1.490s · 53MB
52MB installed
● package 52MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AuthX
✓ from authx import AuthX
✗ from authx.core import AuthX
AuthX is exported at package level, not from core submodule
AuthXConfig
✓ from authx import AuthXConfig
✗ from authx.config import AuthXConfig
Config class is re-exported at package level

Minimal FastAPI app with AuthX JWT authentication

from fastapi import FastAPI, Depends from authx import AuthX, AuthXConfig app = FastAPI() config = AuthXConfig() config.JWT_SECRET_KEY = "secret" config.JWT_ACCESS_TOKEN_EXPIRES = 3600 auth = AuthX(config=config) @app.get("/protected") def protected(user = Depends(auth.get_current_user)): return {"user": user} @app.post("/login") def login(username: str, password: str): # Validate credentials (pseudo) if username == "test" and password == "pass": token = auth.create_access_token(uid="123") return {"access_token": token, "token_type": "bearer"} return {"error": "Invalid credentials"}
Debug
Known issues
breakingVersion 1.6.0 introduces rate limiting and session management. If you were using custom rate limiting or session handling, review changes.
fix
Update your code to use built-in rate limiting: auth.add_rate_limit(...) or session management: auth.create_session(...)
affects: >=1.6.0
breakingVersion 1.5.0 drops support for Pydantic v1. Only Pydantic v2 is supported.
fix
Upgrade your project to Pydantic v2. If you need Pydantic v1, stay on authx<=1.4.3.
affects: >=1.5.0
deprecated'data' keyword argument in decode_token is deprecated since 1.4.2. Use 'extra' instead.
fix
Replace decode_token(token, data=...) with decode_token(token, extra=...)
affects: >=1.4.2
gotchaJWT_SECRET_KEY must be set; otherwise AuthX defaults to an insecure key. In production, use a strong secret via environment variable.
fix
config.JWT_SECRET_KEY = os.environ.get('AUTHX_SECRET_KEY', 'fallback')
affects: all
Errors
Common errors & fixes
ImportError: cannot import name 'AuthX' from 'authx'
AuthX was renamed from AuthXCore in early versions; or using wrong import path.
fix
Use 'from authx import AuthX' (package export). Do not use 'from authx.core import AuthX'.
ModuleNotFoundError: No module named 'authx'
AuthX not installed or installed in wrong environment.
fix
Run 'pip install authx' and ensure the environment is active.
AttributeError: 'AuthXConfig' object has no attribute 'JWT_SECRET_KEY'
Trying to set a config attribute before initializing properly or using an outdated config class.
fix
Check version: 'from authx import AuthXConfig'; config = AuthXConfig(); config.JWT_SECRET_KEY = '...'
Upgrade
Version history
1.7.0latest on PyPI · released Jun 10, 2026
Audit
Dependencies
fastapirequiredAuthX is designed for FastAPI applications
pydanticrequiredRequest/response models (v2 only since 1.5.0)
Agent activity
31 hits · last 30 days
node
26
OpenAI (training)
1
Resources
authx — pip install authx · libregistry