Chapter 3
Auth & RBAC
JWT, OAuth2, 2FA, and role-based access.
~32 min total4 lessonsAssignment
By the end of this chapter you'll be able to
- Add JWT auth
- Wire OAuth2 (Google + GitHub)
- Add TOTP 2FA
- Apply role guards
Lessons
Chapter assignment
Lock down a route
Add a `/api/admin/stats` endpoint that returns user counts. Protect it with the Auth middleware AND `RequireRoles("admin")`. Verify a regular user gets 404 and an admin gets 200.
See success criteriaLesson 1 takes ~9 min.
Start chapterSpot a typo? Have an idea?
Help us improve this chapter. One click opens a GitHub issue with this chapter's URL pre-filled â suggest a clearer wording, report a bug, or request a new lesson. The course keeps improving thanks to learners like you.
Suggest an improvement on GitHub