Authentication vs Authorization

Authentication and authorization are two different security concepts.

Authentication determines who the user is.

For example, a user enters an email and password. The backend verifies those credentials and establishes an authenticated identity.

Authorization determines what the authenticated user is allowed to do.

For example:

  • A normal user can view their own profile.
  • An administrator can view all users.
  • An administrator can delete accounts.

A user may be authenticated but still not have permission to perform a particular operation.

Our application will implement JWT authentication and role-based authorization.

Authentication vs Authorization

FeatureAuthenticationAuthorization
PurposeVerify identityVerify permissions
ExampleUser loginAdmin-only endpoint
WhenBefore granting authenticated accessAfter identity is established
Failure401 Unauthorized403 Forbidden
Key Takeaways
  • Authentication verifies identity.

  • Authorization checks permissions.

  • A valid login does not automatically grant administrative access.