Implemention of Token-based authentication using FastAPI and JSON Web Tokens
FastAPI-JWT-Authentication
├── app # contains app files
| ├── api.py
| ├── auth
| | ├── auth_bearer.py
| | └── auth_handler.py
| └── models.py
├── .env
├── main.py # Application entry point
├── requirements.txt # project dependencies
├── secret_generator.py # Python script to help in generation of SECRET KEY
└── README.md
git clone https://github.com/maxwellwachira/FastAPI-JWT-Authentication.git
cd FastAPI-JWT-Authentication/
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
The secret in the environment file (.env.example) should be something stronger and should not be disclosed. I recommend using secret_generator.py to generate the secret key
Special thanks to Abdulazeez Abdulazeez Adeshina for the awesome tutorial and also to Sebastián Ramírez aka @tiangolo the creator of FastAPI