Skip to content

butyr/fastapi_user_authentication_template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

User Authentication

This is a template for simple user authentication with FastAPI. It handles the following tasks:

  • storage of user credentials
  • user credential authentication
  • token generation
  • token authentication

Password Storage and Validation

Storage

To allow for safe storage of user credentials the password hash is computed using a concatenation of a random string and the user provided password. The salt (the random string) and the hashed password are stored together.

alt text

Validation

To validate a provided password, the salt and the hashed password are retrieved. Then the hashed password is recomputed using the provided password and the retrieved salt. If the produced hash is equal to the retrieved hashed password, then the provided password is valid.

alt text

Sources

About

Template for user authentication using FastAPI

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages