Skip to main content

Module 12 — Authentication & Security

What This Module Covers​

Authentication is one of the most important (and most commonly broken) parts of any application. This module teaches you how to implement it correctly.

Learning Objectives​

  • Hash passwords with bcrypt (never store plaintext)
  • Sign and verify JWTs for stateless authentication
  • Implement login, register, logout, and refresh token flows
  • Write auth middleware that protects routes
  • Understand common auth vulnerabilities and how to avoid them

Auth Concepts​

ConceptWhat It Is
AuthenticationProving who you are (login)
AuthorizationWhat you're allowed to do (permissions)
JWTSigned token containing claims — stateless
Refresh TokenLong-lived token used to get new access tokens
bcryptOne-way password hashing algorithm
httpOnly CookieCookie inaccessible to JavaScript (XSS-safe)

Module Lessons​

  1. JWT Auth
  2. bcrypt Hashing
  3. Auth Middleware
  4. Refresh Tokens

Challenge​

Add full authentication to your Note Taker API:

  • Register and login endpoints
  • Notes are private per user
  • JWT in httpOnly cookie
  • Protected routes

View Challenge →