Creating the Authentication Table

Learn how to create an authentication table.

Creating auth_orm.py

Implementing JWT in the database requires creating a new table that stores the usernames and enough information to verify the password, without actually storing the passwords since that’s an unnecessary security risk. The password hash is computed by applying the md5 function from the hashlib package to a concatenation of the user name, the password salt, and the password. How they are concatenated doesn’t matter so long as it’s done the same way each time. Here’s the entire Auth ORM class.

Get hands-on with 1200+ tech skills courses.