Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

FastAPI with Authentication JSON Web Tokens (JWT)

Example app to easily add token-based authentication to your FastAPI applications. JWT tokens are a secure and efficient way to authenticate users in modern web applications.

FastAPI-JWT

First Steps

  1. Clone the Repository:
git clone https://github.com/GabrielPy28/FastAPI-JWT.git
  1. In the terminal run comand:
> python
> import secrets
... secrets.token_hex(16)
  1. Configure environment variables
echo "SECRET_KEY = use your secret code with secrets.token_hex(16) here" >> .env
echo "ALGORITHM = HS256" >> .env
  1. Install requirements
pip install -r requirements.txt
  1. Run app:
uvicorn main:app --reload

Note

If everything is working correctly, the app is running on http://127.0.0.1:8000, to access all endpoints, go to http://127.0.0.1:8000/docs

About

Example App to Authentication in a FastAPI application using JSON Web Tokens (JWT).

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages