Authentication interview question · Most asked

What is the difference between authentication and authorization?

Summary

Authentication (authN) verifies who you are; authorization (authZ) decides what you're allowed to do. Authentication happens first and produces an identity; authorization uses that identity (plus roles, attributes and context) to allow or deny each action.

Longer Answer

Logging in with a password or passkey is authentication; checking whether that user may delete an invoice is authorization. HTTP status codes reflect the difference: 401 Unauthorized means 'not authenticated' (despite its name), 403 Forbidden means 'authenticated but not allowed'. Authorization must be enforced on every request on the server, close to the data.

Key Points

  • AuthN = identity
  • AuthZ = permissions
  • 401 vs 403
  • Enforce authZ server-side on every request

Explanation

What interviewers look for

Precise definitions plus the 401/403 nuance.

More most-asked Authentication questions

← All Authentication questions