Authentication and authorization are core concepts in identity and access management (IAM), which are often confused with each other. While both relate to identity security, they aren’t interchangeable.
You log in to GitHub (authentication), then try to delete someone else's repository. GitHub knows who you are, but stops you (authorization).
Authentication must happen first: You prove your identity. Authorization happens next: Your permissions determine what you can access.
Authentication answers: “Who are you?”
Before your application lets anyone in, it needs to verify their identity. When users sign in, you’re validating credentials (or other factors) to confirm they are who they claim to be. Authentication always comes first. You can’t decide what someone can access until you know who they are.
Think of authentication like airport security. You show your ID to prove your identity, and the agent verifies you are who your ID claims you are.
When a user requests application access:
Authorization determines what authenticated users are allowed to do within a system. Common approaches include:
| Method | Description | Example |
|---|---|---|
| Role-based access control (RBAC) | Users are assigned pre-defined roles (admin, editor, viewer) with fixed permissions | An editor can modify documents; a viewer can only read them |
| Attribute-based access control (ABAC) | Access decisions based on dynamic attributes (user properties, resource metadata, environmental context) | Finance resources are only accessible from the corporate network during business hours |
| Relationship-based access controls (ReBAC) | Authorization based on relationships between users and resources | An employee can edit their own documents, but not their teammate’s private drafts |
Consider a project management application:
When working with modern protocols, it’s crucial to understand the distinctions between AuthN vs. AuthZ.
| Aspect | Authentication (AuthN) | Authorization (AuthZ) |
|---|---|---|
| The Question | Who are you? | What can you do? |
| The Process | Verifies identity | Verifies permissions |
| Sequence | Must happen first | Happens after authentication |
| Methods | Passwords, Passkeys, MFA, SSO, OIDC | RBAC, ABAC, ReBAC |
| Token Type | ID token (identity claims) | Access token (permissions/scopes) |
| HTTP Status | 401 Unauthorized (failed to prove identity) | 403 Forbidden (identity known, permission denied) |
OAuth 2.0 is an authorization framework. It is not an authentication protocol.
OAuth 2.0 provides a standardized way for a client application to obtain an access token from an authorization server (with a user’s consent) to access protected resources. It was designed for delegated authorization, allowing users to grant third-party applications limited access to their resources without sharing their passwords.
OIDC is an interoperable authentication protocol built on top of the OAuth 2.0 framework. It simplifies the process of verifying user identity based on authentication performed by the authorization server.
It addresses what OAuth 2.0 doesn’t provide:
In modern architectures:
Both protocols typically work together in the same flow.
Modern applications are distributed systems built around APIs and have become a primary means of accessing resources.
The fundamental shift: APIs don’t authenticate users directly. They validate tokens and enforce API authorization.
[Authorization: Bearer] header.JSON Web Tokens (JWTs) are the most common token format. They are self-contained, carrying all necessary information embedded within the token itself.
A JWT is comprised of a header, payload (claims), and signature.
When an API receives a JWT, validation is non-negotiable. Skipping any of these validations creates application security vulnerabilities.
Five essential validation checks:
exp claimiss claim (issuer)aud claim is a match with the value identifying your applicationOAuth 2.0 doesn't mandate a specific access token format. While JWTs are popular, an alternative is the opaque token, a random string that contains no embedded information about the user or the token itself.
| Feature | JWT Access Tokens | Opaque Access Tokens |
|---|---|---|
| Validation | Stateless (API validates locally) | Stateful (API must call the authorization server's introspection endpoint on every request) |
| Revocation | Difficult to revoke before expiration | Instant revocation capability |
| Performance | Lower latency on API requests (faster) | Authorization server lookup adds latency |
| Scalability | Scales well in distributed architectures | The authorization server becomes a critical dependency |
Both are valid OAuth 2.0 implementations. Many systems use JWTs with short expiration times and refresh token rotation to balance performance and security.
The Authorization Code Flow with Proof Key for Code Exchange (PKCE) is the most secure OAuth 2.0 flow for web and mobile applications, demonstrating how AuthN and AuthZ work together. Using PKCE protects the flow from interception attacks.
| Consideration | Recommendation |
|---|---|
| Token Lifetime | Use short-lived access tokens (15–60 minutes) and a refresh token to acquire new access tokens without forcing users to log in. |
| Least Privilege | Request the minimum required scopes an application needs to minimize the risk of potential damage from compromised tokens. |
| Token Validation | Always validate tokens to reduce security risks. |
| Token Storage | Never store sensitive tokens in localStorage or sessionStorage. Use secure HttpOnly cookies or secure backend session storage. |
Building secure applications requires understanding the distinction between authentication and authorization:
| Concept | What It Solves | Protocol/Token |
|---|---|---|
| Authentication | Identity Verification | OpenID Connect, ID Token |
| Authorization | Access Control | OAuth 2.0, Access Token |
For a deeper dive into token types, learn the difference between the ID token and the access token.
Using a service like Auth0 can simplify the implementation of both authentication and authorization, enabling developers to concentrate on their core application logic. Explore our Intro to IAM series for additional topics related to identity and access management.
These materials are intended for general informational purposes only. You are responsible for obtaining security, privacy, compliance, or business advice from your own professional advisors and should not rely solely on the information provided herein.
Table of contents
Build vs. Buy?
Find out what to do for your authentication and authorization needs.
Get the whitepaperQuick assessment
Which of these use cases describe authentication systems? (choose all that apply)
Quick assessment
Which of these answers is correct?