Skip to content

maxwellwachira/FastAPI-JWT-Authentication

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Securing FastAPI with JWT Token-based Authentication

Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.

Description

Implemention of Token-based authentication using FastAPI and JSON Web Tokens

Table of contents

Prerequisites

Directory-Structure

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

Setting-up-Local-Environment

clone the repository and navigate to the project directory

git clone https://github.com/maxwellwachira/FastAPI-JWT-Authentication.git
cd FastAPI-JWT-Authentication/

Create a python virtual environment and activate it

python3 -m venv venv
source venv/bin/activate

Install Project dependencies

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

Acknowledgement

Special thanks to Abdulazeez Abdulazeez Adeshina for the awesome tutorial and also to Sebastián Ramírez aka @tiangolo the creator of FastAPI

License

license

About

Securing FastAPI with JWT Token-based Authentication

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published