Skip to content

Pre-made FastAPI authentication template to be used in any project to add an OAuth2-password-flow-based authentication with JWT.

Notifications You must be signed in to change notification settings

outoflaksh/fastapi-jwt-auth-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FastAPI Authentication Template

Implementing user login with OAuth2 Password-flow & JWT

Table of Contents
  1. About The Project
  2. Getting Started
  3. Acknowledgments

About The Project

Implementing a user model in your application always seems like a painful task, at least to me. It's always the exact same code with minor configurations but it still takes a lot of time to build and add to the codebase. That's why, I decided to put all the core user model code in one place so that all it takes to integrate one in your existing application, is just a few quick changes.

This template implements a complete, secure, fast, and easy-to-add user sign in and sign up model code that works on the OAuth2 password-based-auth-flow and preserves and authorises the user on the basis of JWT tokens, for FastAPI-based applications.

All you need to do is to modify the database schemas according to your needs (or leave it the same depending upon what you want), and add your database handling code to the file, that connects and handles the queries from whatever database engine your application is using.

(back to top)

Built With

(back to top)

Getting Started

Installation

  1. Clone the repo.
    git clone https://github.com/outoflaksh/fastapi-jwt-auth-template.git
  2. Change your working directory to the cloned repo.
    cd fastapi-jwt-auth-template
  3. Install the dependencies.
    python3 -m pip install -r ./requirements.txt
    OR
    pip install -r ./requirements.txt
  4. Start the FastAPI server with Uvicorn.
    uvicorn main:app

Acknowledgments

About

Pre-made FastAPI authentication template to be used in any project to add an OAuth2-password-flow-based authentication with JWT.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages