Authorization vs Authentication
What you'll learn: You'll learn to clearly distinguish authentication from authorization—two related but fundamentally different security concepts that often get confused.
The Core Distinction
Authentication answers the question: "Who are you?" It's the process of verifying identity—proving that you are who you claim to be. When you log in with a username and password, use TOTP from an authenticator app, or scan your fingerprint, you're authenticating.
Authorization answers the question: "What are you allowed to do?" It's the process of determining permissions and access rights after you've been authenticated. Authorization decides which resources you can access and what actions you can perform.
The Hotel Analogy
Think of staying at a hotel:
- Authentication is checking in at the front desk. You show your ID and reservation to prove you're the person who booked the room. The clerk verifies your identity.
- Authorization is what happens when you use your room key. The key unlocks your room (authorized) but not other guests' rooms (unauthorized). The system knows who you are and what you're allowed to access.
They Work Together
These concepts are sequential and complementary:
- First, authentication establishes identity
- Then, authorization determines permissions based on that identity
You cannot have proper authorization without authentication—the system needs to know who you are before it can decide what you can do. However, authentication alone is insufficient for security; even authenticated users shouldn't access everything.
Common Confusion
Logging in successfully only means you're authenticated. Whether you can view admin panels, delete files, or access certain APIs depends on your authorization level (roles, permissions, access control lists).
Key Takeaway: Authentication verifies identity ("who you are"), while authorization controls access ("what you can do")—authentication must happen first, but both are essential for complete security.