Skip to content

FastAPI JWT Auth

Tests CodeQL PyPI version Downloads


Documentation: https://LibreNZ.github.io/libre-fastapi-jwt

Source Code: https://github.com/LibreNZ/libre-fastapi-jwt


>This project was originally based on fastapi-jwt-auth . It has now been extensively modified and kept up to date.

Features

A FastAPI extension that provides JWT authentication support (secure, easy to use and lightweight), if you were familiar with flask-jwt-extended this extension suitable for you, it was originally inspired by flask-jwt-extended 😀

  • Integrated with the drawing button of OpenAPI
  • Access tokens and refresh tokens
  • Freshness Tokens
  • Revoking Tokens
  • Dual Tokens (cookie and headers)
  • Support for WebSocket auth
  • Support for adding custom claims to JSON Web Tokens
  • Storing tokens in cookies and CSRF protection
  • Support for JWKS endpoints for 3rd party token validation

Installation

The easiest way to start working with this extension with pip

pip install libre-fastapi-jwt

To use asymmetric (public/private) key signing algorithms, include the asymmetric extra requirements.

pip install 'libre-fastapi-jwt[asymmetric]'

License

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