Setting up user registration
User registration is the first step in securing your FastAPI application. It involves collecting user details and storing them securely. Here’s how you can set up a basic user registration system. The recipe will show you how to set up a FastAPI application’s registration system.
Getting ready
We will start by storing users in an SQL database. Let’s create a project root folder called saas_app
, containing the code base.
To store user passwords, we will use an external package to hash plain text with the bcrypt algorithm. The hashing function transforms a text string into a unique and irreversible output, allowing for secure storage of sensitive data such as passwords. You can find more details at https://en.wikipedia.org/wiki/Hash_function.
If you haven’t installed packages from requirements.txt
from the GitHub repository of the chapter under the saas_app
project folder,, you can install the passlib
package with bycrypt...