Skip to content

This article will teach you how to create a CRUD RESTful API with Python, FastAPI, PyMongo, MongoDB, and Docker-compose to perform the basic Create/Read/Update/Delete operations against a database.

Notifications You must be signed in to change notification settings

wpcodevo/fastapi_mongodb

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

API with Python, FastAPI, and MongoDB: JWT Authentication

This article will teach you how to add JSON Web Token (JWT) authentication to your FastAPI app using PyMongo, Pydantic, FastAPI JWT Auth package, and Docker-compose.

API with Python, FastAPI, and MongoDB: JWT Authentication

Topics Covered

  • How to Setup FastAPI with MongoDB
  • Starting the FastAPI Server
  • Set up Environment Variables with Pydantic
  • Connect to the MongoDB Database
  • Creating the Schemas with Pydantic
  • Create Serializers for the MongoDB BSON Documents
  • Password Management in FastAPI
  • Creating Utility Functions to Sign and Verify JWTs
  • Creating the Authentication Controllers in FastAPI
    • User Registration Handler
    • User Sign-in Handler
    • Refresh Access Token Handler
    • Sign out User Handler
  • How to Protect Private Routes
  • Creating a User Handler
  • Adding the API Routes and CORS
  • Testing the API with Postman

Read the entire article here: https://codevoweb.com/api-with-python-fastapi-and-mongodb-jwt-authentication

Articles in this series:

1. API with Python, FastAPI, and MongoDB: JWT Authentication

API with Python, FastAPI, and MongoDB: JWT Authentication

2. Build API with Python & FastAPI: SignUp User and Verify Email

Build API with Python & FastAPI: SignUp User and Verify Email

3. CRUD RESTful API Server with Python, FastAPI, and MongoDB

CRUD RESTful API Server with Python, FastAPI, and MongoDB

About

This article will teach you how to create a CRUD RESTful API with Python, FastAPI, PyMongo, MongoDB, and Docker-compose to perform the basic Create/Read/Update/Delete operations against a database.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published