JWT Middleware for FastAPI
Project description
jwt_middleware
A module for a middleware for our JWT token decryption.
Will throw a HTTP exception code 401 in case of missing token, token expiration or invalid token.
Installation
pip3 install jwt-middleware
Usage
from fastapi import FastAPI
from jwt_middleware import JWTMiddleware
app = FastAPI()
# Add the JWT middleware
app.middleware("http")(JWTMiddleware(secret_key="your-secret-key"))
@app.get("/")
async def root():
return {"message": "Welcome, authorized user!"}
Publish a new version
Pre-requisites:
pip3 install setuptools
pip3 install wheel
pip3 install twine
- Update the version number in setup.py
- Build the package:
python3 setup.py sdist bdist_wheel
- Verify the package:
twine check dist/*
- Publish the package:
twine upload dist/*
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
jwt_middleware-2.0.0.tar.gz
(2.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jwt_middleware-2.0.0.tar.gz.
File metadata
- Download URL: jwt_middleware-2.0.0.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b5c31229c7168880967c4f0df7ca79f30608449fff2f6254fd5b149fccf6e88
|
|
| MD5 |
1d928cbcdda1feccd9cfe471f8791513
|
|
| BLAKE2b-256 |
330f6633adefe0ea64b7c2a50548a42e3469a7587ff259cdfffb412dd45d845d
|
File details
Details for the file jwt_middleware-2.0.0-py3-none-any.whl.
File metadata
- Download URL: jwt_middleware-2.0.0-py3-none-any.whl
- Upload date:
- Size: 3.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a9609bd402cb12d16d85a34126298d7dcb428d7815b870911a5748aff7f89f36
|
|
| MD5 |
0a606ab649b5563d40abaf77efa0e909
|
|
| BLAKE2b-256 |
fc595c656182b032f3273c01f0180b5bdf904ddbcaf8521d84edc1510afcc7f5
|