Authentication vs. Authorization

In system design security, we deal with two fundamental questions that sound similar but are completely different.


1. Authentication (AuthN)

Question: Who are you?

Authentication is the process of verifying the identity of a user or system.

Common Methods:


2. Authorization (AuthZ)

Question: What are you allowed to do?

Authorization is the process of verifying what specific files, data, and permissions an authenticated user has.

Common Models:


Comparison Summary

Feature Authentication (AuthN) Authorization (AuthZ)
Pillar Identity Permissions
Order Happens first Happens second
Example Entering your ID badge into the office door. The badge only lets you into the 3rd floor, not the server room.
Transferred via ID Tokens Access Tokens (e.g., Scopes)

The Workflow in Microservices

  1. Client talks to the Identity Provider (IdP) to authenticate.
  2. IdP returns an ID Token (who they are) and an Access Token (what they can do).
  3. Client sends the Access Token to the API Gateway.
  4. API Gateway (or the individual service) checks the Access Token for the required "Scopes" before allowing the action.

Key Takeaways

Identity is about proof. Permissions are about boundaries.