Python Backend #4: Add Basic Auth to Your Flask API
923 views on YouTube
๐ Build a secure login system with Flask + SQLite!
In this video, we add a basic user system to our API โ allowing registration and login using hashed passwords. This is the foundation of authentication in any backend.
Previous Video: https://youtu.be/UqH77WhRLH0
Previous Python build file: https://github.com/NDCSwift/Swift-Projects/raw/refs/heads/main/Python-Projects/PythonBackend3.zip
๐ง What Youโll Learn:
โ
How to create a users table
โ
How to hash passwords with hashlib
โ
How to register users securely
โ
How to verify login credentials
โ
How to handle errors & conflicts
๐ Tools Used:
Python 3
Flask
SQLite (built-in)
VS Code
DB Browser for SQLite
Postman Register / Login
{
“username”: “testuser”,
“password”: “secure123”
}
๐ฅ Download My Project Files
๐ Get the source code here:
๐ https://ndcswift.github.io/Swift-Projects/
โฑ๏ธ Timestamps:
00:00 โ Intro & goals
00:44 โ Updating our imports
01:08 โ updating our init to support users
02:32 โ Creating the /register route
04:00 โ Creating a hashed password
07:08 โ Creating the /login route
10:45 โ Quick Bug / typing fixes
11:17 โ Testing user flows with Postman
11:35 โ Checking hashed passwords
13:27 โ Outro & What’s next