LESSON 04 / 11·2 min readIntermediate

Authentication vs authorization vs RBAC?

01 Understand02 Recall03 Prepare

Understand the concept

Authentication checks the caller's identity, authorization decides whether that identity may perform an action, and RBAC groups permissions into roles. These checks work together but answer different questions. A logged-in employee should not automatically gain access to every employee's records.

Important ideas

  • Authentication checks identity; authorization checks access.

  • RBAC assigns permissions through roles.

  • Also check record ownership and tenant boundaries on each protected operation.

  • Use record ownership or tenant scope in addition to broad roles, and deny access when the relevant rule cannot be established.

Comparison:

PointAuthenticationAuthorization
QuestionWho is the caller?May this caller do this?
ExampleVerify a login/session/tokenVerify ownership of an order
Typical failure401 for missing/invalid credentials403 for known but disallowed access
Checked only at loginNo; requests need identity contextNo; check each protected operation
  • Some APIs use 404 instead of 403 to avoid revealing that a protected resource exists.
PAUSE & RECALL

Can you explain it without the notes?

Authentication vs authorization vs RBAC?

Use your own words. Explain an example and one limitation before checking the explanation.

Check your explanation

Authentication checks the caller's identity, authorization decides whether that identity may perform an action, and RBAC groups permissions into roles. These checks work together but answer different questions. A logged-in employee should not automatically gain access to every employee's records.

CONNECT IT TO YOUR INTERVIEW

Turn this concept into a clear answer.

  • Give an example where authentication succeeds but authorization fails, such as a normal user calling an admin endpoint.
Practice this concept
YOUR NEXT STEP

Keep connecting the ideas.

Next lesson: What makes JWT or session authentication safe?

Adapted from 08_PERFORMANCE_SECURITY.md · “Authentication vs authorization vs RBAC?”. Examples are study fragments; framework behavior can depend on your version.