Skip to content
Tech Interview Prep
Technical interview guide

Authentication vs. Authorization

Proving who you are versus what you're allowed to do, and the protocols behind each.

Minutes to read
3
Practice MCQs
25
Interview Q&A
25
Edition
v4
Editorial status
Reviewed

Scope: NIST SP 800-63 Revision 4, OWASP Cheat Sheet Series, and RFC 6750 guidance accessed 2026-08-31..

Overview

Curated: · Written: · Reviewed:

Authentication vs. Authorization

In one line

Authentication establishes who the subject is. Authorization decides whether that subject may perform this action on this resource right now, and it consumes the principal that authentication produced. Reach for the split on every request, enforced at the resource server.

Key definitions

  • Principal: the identifier, assurance level and context that authentication outputs. Only verified session or token state may produce one.
  • PEP (policy enforcement point): the resource-side code that extracts the credential and refuses to run the handler without an allow.
  • PDP and PIP: the policy decision point evaluates (principal, action, resource, context). The policy information point supplies attributes such as owner and tenant.
  • Audience (aud): the API a token is meant for. An ID token's audience is the client, not your API.
  • Capability: a session ID or bearer token. Whoever holds it acts as the subject.
  • IDOR: an authenticated caller reaches an object because the handler never compared its owner or tenant to the principal.

How it works

  1. Extract the credential and verify it. Derive the principal only from verified state, never from a client-supplied user ID.
  2. Load the resource and read its owner and tenant.
  3. Ask the PDP: (principal, action, resource, context).
  4. Allow runs the handler. Deny returns 403. No valid principal returns 401. A PDP timeout denies.
no yes allow deny or timeout Request with credential Credential verifies? 401 Load resource: owner, tenant PDP: principal, action, resource, context Run handler 403

When to use and when not to

OptionReach for it whenCost you accept
Server-side sessionRevocation must be immediate, such as admin sessionsA store read on every request
Stateless JWTMany services verify locally and some revocation lag is acceptableValid until exp unless you add a denylist or introspection
Reference token (introspection)Immediate revocation across servicesA round trip to the authorization server
RBACThe permission set is small and stableRole explosion
ABACPolicy depends on context such as device or classificationPolicy is harder to test and explain
ReBACData is collaborative and graph-shapedThe policy engine sits on the critical path

Traps interviewers probe

  1. Using an ID token as an API credential. The API must check aud and require an access token issued for it. Fix: validate aud, iss, exp and a pinned algorithm, and reject tokens whose audience is not this API.
  2. Treating MFA as authorization. MFA raises authentication assurance and leaves object checks untouched. Fix: compare the object's owner and tenant to the principal on every read and write.
  3. Relying on hidden UI. The route is still callable. Fix: enforce at the resource, deny by default, and test the direct call.
  4. Trusting a client-supplied ID or an unverified role claim. Fix: derive the subject from the verified token or session, and check the specific claim the decision needs.
  5. Assuming logout revokes a JWT. Logout clears client state only. Fix: keep exp short, revoke refresh tokens, or denylist by jti, and state the latency you accept.

Interview tips

Opening: Authentication establishes the subject. Authorization decides this action on this object, using the subject from that step.

Follow-ups to expect:

  • Which comes first, and what does authorization consume? Authentication, then a principal from a verified session or token.
  • How do you revoke a JWT? Short exp plus refresh revocation, a jti denylist, or introspection for reference tokens.
  • How do you stop IDOR? Load the object, compare owner and tenant to the principal, deny by default, and test the denied cases.
  • Why is an ID token not an access token? It proves an authentication event to the client. Its audience keeps it from authorizing API calls.
  • How do you cache decisions? Key on subject, tenant, policy version, resource, action and context, with a TTL and version-based invalidation.
  • Impersonation or delegation? Audit the actor and the effective subject as separate fields, and make the grant time-bounded and revocable.

30-second outline:

  • Who: verify the credential and derive the principal from verified state.
  • What: load the resource, check tenant and owner, ask policy, default deny.
  • Where: enforce at the resource server and fail closed.
  • Trade-off: server-side sessions revoke immediately, while JWTs verify cheaply but lag until exp.

Feedback on this overview

Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.