Skip to main content

Ready to use and customizable Authentications and Oauth2 management for FastAPI

Project description

AuthenticationX 💫

authx

Ready-to-use and customizable Authentications and Oauth2 management for FastAPI ⚡

lint Package version Test


Source Code: https://github.com/yezz123/AuthX

Documentation: https://authx-v0.yezz.me/


Add a Fully registration and authentication or authorization system to your FastAPI project. AuthX is designed to be as customizable and adaptable as possible.

Features 🔧

  • Support Python 3.9+.
  • Extensible base user model.
  • Ready-to-use register, login, reset password and verify e-mail routes.
  • Ready-to-use Social login and Oauth2 routes.
    • Full Configuration and customization.
    • Ready-to-use social OAuth2 login flow.
  • Middleware Support for Oauth2 using Authlib and Starlette.
  • Dependency callable to inject current user in route.
  • Pluggable password validation
    • Using Captcha Service.
    • Implements the HMAC algorithm And Hashlib library.
  • Using Email Service. (SMTP)
  • Extensible Error Handling
  • High level API to manage users, roles and permissions
  • Using Redis as a session store & cache.
  • Support HTTPCache.
  • Customizable database backend:
  • Multiple customizable authentication backend:
    • JWT authentication backend included
    • Cookie authentication backend included
  • Full OpenAPI schema support, even with several authentication backend.
  • Provide a Docstring for each class and function.
  • Support Sessions and Pre-built CRUD functions and Instance to launch Redis.
  • Support SocketIO.
  • Support Middleware of pyinstrument to check your service performance.
  • Support Middleware for collecting and exposing Prometheus metrics.

Note: Check Release Notes.

Project using 🚀

from fastapi import Depends, FastAPI
from authx import Authentication, User, RedisBackend

app = FastAPI()
# Set up Authentication & Authorization
auth = Authentication()

# Set up Pre-configured Routes
app.include_router(auth.auth_router, prefix="/api/users")
app.include_router(auth.social_router, prefix="/auth")
app.include_router(auth.password_router, prefix="/api/users")
app.include_router(auth.admin_router, prefix="/api/users")
app.include_router(auth.search_router, prefix="/api/users")

# Set Redis Cache
auth.set_cache(RedisBackend)

# Set Anonymous User
@app.get("/anonym")
def anonym_test(user: User = Depends(auth.get_user)):
    pass


# Set Authenticated User
@app.get("/user")
def user_test(user: User = Depends(auth.get_authenticated_user)):
    pass


# Set Admin User (Only for Admins)
@app.get("/admin", dependencies=[Depends(auth.admin_required)])
def admin_test():
    pass

Contributors and sponsors ✨☕️

All Contributors

Thanks goes to these wonderful people (emoji key):

Yasser Tahiri
Yasser Tahiri

💻 📖 🚧 🚇
Abderrahim SOUBAI-ELIDRISI
Abderrahim SOUBAI-ELIDRISI

👀 📖
Ismail Ghallou
Ismail Ghallou

💻 🛡️
talentuno LLC
talentuno LLC

💵
Cactus LLC
Cactus LLC

💵
MojixCoder
MojixCoder

💻 🐛
Stéphane Raimbault
Stéphane Raimbault

💻 🔌
theoohoho
theoohoho

📖
Yogesh Upadhyay
Yogesh Upadhyay

🐛
Roman
Roman

🐛
Alvaro Lopez Ortega
Alvaro Lopez Ortega

📖

This project follows the all-contributors specification. Contributions of any kind welcome!

Links 🚧

License 📝

This project is licensed under the terms of the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

authx-0.9.1.tar.gz (183.3 kB view hashes)

Uploaded Source

Built Distribution

authx-0.9.1-py3-none-any.whl (49.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page