Lesson Complete!

Build Your Auth Module

What you built

You created auth.py — a complete authentication module with four pieces:

  • User model: User(SQLModel, table=True) with id, email, and password_hash — a database table for user accounts
  • Password hashing: hash_password() and verify_password() using bcrypt — passwords are never stored as plain text
  • JWT creation: create_access_token() builds a signed token with the user's email and a 30-minute expiry
  • Token verification: get_current_user() extracts and validates the token, then looks up the user in the database

What comes next

The auth module is complete but not connected to your app. No one can register or log in yet — there are no endpoints for that.

Lesson 2 adds POST /register and POST /login endpoints that use the functions you just built.