Blog · Guides

Authentication vs authorization: what's the difference?

Authentication proves who a user is; authorization decides what they may do. Examples, the protocols and models for each (OIDC, SAML, OAuth 2.0, RBAC, ABAC), HTTP 401 vs 403, and where each check belongs.

Casdoor Team · October 21, 2026 · 3 min read

This guide is written by the team that builds Casdoor and describes the standards as published (listed under Sources), with notes on how Casdoor implements them as of October 21, 2026. Spotted a mistake? Tell us.

Authentication answers "who are you?" Authorization answers "what are you allowed to do?" A hotel is the classic example: showing your passport at the front desk is authentication; the key card that opens your room, and not anyone else's, is authorization.

Every secure application does both, in that order: first establish who the user is, then check each action against what that user may do.

At a glance

Authentication (AuthN) Authorization (AuthZ)
Question Who are you? What may you do?
Happens At sign-in, and when a session is checked On every action or request
Based on Something you know, have or are: password, passkey, one-time code, biometrics Roles, attributes, relationships, policies
Standards OpenID Connect, SAML, WebAuthn, LDAP, RADIUS OAuth 2.0 scopes; models such as ACL, RBAC, ABAC, ReBAC
Result An identity, a session or an ID token Allow or deny, or an access token with scopes
HTTP error when it fails 401 Unauthorized (despite the name, it means "not authenticated") 403 Forbidden
User can change it Yes, by signing in No, an admin or a policy grants it

Authentication

Authentication proves an identity. Common methods:

  • Passwords, ideally with MFA (a second factor such as a TOTP app or SMS code).
  • Passkeys (WebAuthn), which replace passwords with a key pair on the user's device.
  • One-time codes and magic links by email or SMS.
  • Single sign-on through an identity provider over OpenID Connect or SAML, so apps delegate the whole job.

The output is something the app can trust for the rest of the session: a session cookie, or an OpenID Connect ID token.

Authorization

Authorization decides, for each request, whether this user may perform this action on this resource. Common models:

  • ACL: a list of who may do what with each object.
  • RBAC: permissions belong to roles, such as editor or admin, and users get roles.
  • ABAC: rules on attributes of the user, the resource and the context, such as "owners may edit their own documents during business hours".
  • ReBAC: access follows relationships, such as "viewers of a folder may read the documents in it".

Apache Casbin explains these models side by side with examples.

Where OAuth 2.0 fits

OAuth 2.0 is an authorization protocol: it gives an application an access token to call an API on a user's behalf, limited by scopes. It was not designed to tell the app who the user is; OpenID Connect adds that authentication layer on top. See OAuth 2.0 vs OpenID Connect.

Where each check belongs

  • Authenticate once, at the edge: at the identity provider, with the app or API gateway verifying sessions or tokens.
  • Authorize close to the data: in the service that owns the resource, on every request. A token's scopes or roles say what an app or user is broadly allowed; the service still checks the specific record ("is this your invoice?").
  • Never trust the client for either: hide a button for usability, but enforce on the server.

Doing both with Casdoor and Casbin

Casdoor is an open-source identity provider for authentication (passwords, passkeys, MFA, social and enterprise SSO over OIDC, SAML, CAS, LDAP and RADIUS). It's built around Casbin, the authorization library, so you can define roles and permissions with ACL, RBAC or ABAC models in Casdoor's console and check them from your apps, or embed Casbin directly in your code.

Self-host Casdoor for free, or run it on Casdoor Cloud from $24/month billed yearly. See also What is an identity provider and What is MFA.

FAQ

Which comes first? Authentication. You can't decide what someone may do until you know who they are, although some resources allow anonymous access.

Why does HTTP 401 say "Unauthorized" when it means unauthenticated? A historical naming quirk. RFC 9110 defines 401 as missing or invalid authentication credentials and 403 as understood but refused.

Is a JWT authentication or authorization? It's a token format used for both: an OIDC ID token is authentication; an OAuth access token carrying scopes or roles is authorization.

Is SSO authentication or authorization? Authentication. SSO lets one sign-in cover many apps; each app still decides what the user may do.

Sources

Product names are trademarks of their respective owners.