Authentication vs Authorization — What's the Difference?

Authentication verifies who a user is (proving identity, typically via login credentials); authorization determines what an already-authenticated user is allowed to do.

Published October 3, 2026

Authentication verifies who you are; authorization decides what you are allowed to do. Login is authentication, access to the admin page is authorization.

The concept

Authentication (AuthN) checks credentials: password, one-time code, passkey or token. A failure returns 401 Unauthorized.

Authorization (AuthZ) checks permissions for an authenticated identity: roles, policies and ownership. A failure returns 403 Forbidden.

Order of checks

  1. Who are you? (authenticate: login, token)
  2. Prove it → identity established
  3. May you do this? (authorize: role/permission)
  4. Allow (200) or deny (403)

Practical examples

Authentication middleware

function authn(req, res, next) {
  const user = verify(req.headers.authorization)
  if (!user) return res.sendStatus(401)
  req.user = user; next()
}

Authorization check

function onlyAdmin(req, res, next) {
  if (req.user.role !== 'admin') return res.sendStatus(403)
  next()
}

Ownership rule

if (post.authorId !== req.user.id) return res.sendStatus(403)

Common mistakes

  • Authenticating but never checking permissions on each action.
  • Using 401 and 403 interchangeably.
  • Trusting a role sent from the client.

Key takeaways

  • AuthN = identity, AuthZ = permission.
  • 401 vs 403.
  • Check authorization on the server, every time.

FAQ

Where does OAuth fit?

OAuth 2.0 is mainly delegated authorization; OpenID Connect adds authentication.

What is RBAC?

Role-based access control: permissions attach to roles that users hold.

More General articles