Authentication vs. Authorization, Explained
If you are reading this, you have probably seen "authN" and "authZ", or "auth" used for both, and you want to know exactly how the two differ, why mixing them up causes real vulnerabilities, and what good practice looks like for each.
By the end you will be able to define both terms, say which comes first and why neither can replace the other, describe the factors and the strongest forms of authentication, explain the main authorization models, read HTTP 401 and 403 correctly, tell OAuth from OpenID Connect, and decide for any security failure whether it was authentication or authorization that broke. It builds on the CIA triad, and it is the foundation for Broken Access Control, Brute Force vs Password Spraying and Privilege Escalation.
1. The short version
Authentication proves who you are. Authorization decides what you are allowed to do.
PortSwigger puts it the same way: authentication is verifying that a user is who they claim to be, and authorization involves verifying whether a user is allowed to do something.
A picture that works: an office building.
| Step | In the building | In a computer system |
|---|---|---|
| You say who you are | You tell the guard your name | You type a username (identification) |
| The guard checks | The guard checks your ID against the list | The system checks your password, key or code (authentication) |
| Which doors open | Your badge opens the lobby and your own floor, not the server room | The system decides which files, pages and actions you may use (authorization) |
Two things follow at once:
- Authentication does not give you permissions. Being who you say you are does not mean you may enter every room.
- Authorization depends on authentication. The system cannot decide what you may do until it knows who you are. (The exception is public content, where the rule is "everyone, including anonymous visitors, may read this".)
2. Definitions from the standards
NIST's glossary collects the formal wording from several documents.
Authentication (NIST glossary):
- "Verifying the identity of a user, process, or device, often as a prerequisite to allowing access to resources in an information system." (FIPS 200)
- In NIST's digital identity guidelines (SP 800-63-4): "The process by which a claimant proves possession and control of one or more authenticators bound to a subscriber account to demonstrate that they are the subscriber."
Authorization (NIST glossary):
- "The decision to permit or deny a subject access to system objects (network, data, application, service, etc.)." (CNSSI 4009 and SP 800-162)
- "The process of verifying that a requested action or service is approved for a specific entity." (SP 800-152, SP 800-57)
- "The process of granting or denying specific requests for obtaining and using information and related information processing services; and to enter specific physical facilities." (SP 800-53)
NIST's glossary also lists a different, organizational meaning of "authorization" (a senior official's decision to let a whole system operate). That one is not what this post is about.
Identification, the step before both, is the claim of an identity. One NIST definition (SP 800-188, citing ISO/TS 25237) is "the process of using claimed or observed attributes of an entity to single out the entity among other entities in a set of identities." In everyday login terms: the username is the claim, and the password is the proof. Some NIST documents use the words "identification" and "authentication" loosely, so use the plain split above when you explain it to someone.
3. Authentication in detail
The three factors
An authentication factor is a kind of evidence. PortSwigger and NIST both list the same three families:
| Factor | Meaning | Examples |
|---|---|---|
| Knowledge (something you know) | A secret in your head | Password, PIN, answer to a security question |
| Possession (something you have) | A physical or digital object | A phone, a hardware security key, a smart card |
| Inherence (something you are or do) | A body characteristic or behaviour | Fingerprint, face, behaviour patterns |
Multi-factor authentication (MFA) means proving possession of two or more different factors. NIST's AAL2 level requires "proof of the possession and control of two distinct authentication factors". Two passwords are two things you know, so they are one factor used twice, not MFA.
Why a password alone is weak
Passwords can be guessed (brute force and spraying), stolen in breaches, reused across sites and handed over to fake login pages (phishing). That is why OWASP Top 10:2025 lists "Authentication Failures" as A07 and recommends multi-factor authentication to block credential stuffing, brute force and reuse of stolen credentials.
Microsoft studied the effect of MFA on a large set of Azure Active Directory accounts that showed suspicious activity. Its researchers report that MFA reduced the risk of compromise by 99.22% across the population, and by 98.56% when credentials had leaked. They note it is one provider's accounts in a specific investigation period, so treat the numbers as strong evidence of direction, not a promise.
Not all MFA is equal
| Method | How it is attacked | Note |
|---|---|---|
| SMS or voice code | Phone-number takeover (SIM swap, porting), or a fake site that collects the code as well as the password | NIST says verifiers should consider risk signals such as SIM change or number porting before using the phone network to deliver a secret, and that email shall not be used for out-of-band authentication |
| Push approval | Repeated prompts until the user taps "approve" | CISA recommends number matching as an interim measure |
| App-generated one-time code | Can still be typed into a fake site | Better than SMS, but not phishing-resistant |
| Passkey or hardware security key (FIDO2/WebAuthn) | Designed so a fake site cannot get a usable response | The strongest widely available option |
NIST defines phishing resistance as "the ability of the authentication protocol to prevent the disclosure of authentication secrets and valid authenticator outputs to an impostor verifier... without relying on the vigilance of the claimant." In other words, it works even when the user is fooled. NIST's methods use cryptographic binding to the channel or to the real site's name. CISA says "the only widely available phishing-resistant authentication is FIDO/WebAuthn authentication", while stressing that any MFA is better than none.
The FIDO Alliance describes a passkey as "an authentication credential based on FIDO standards, that can be stored on your phone or computer, or in a hardware security key." FIDO says passkeys replace passwords with cryptographic key pairs, used from your own devices or security keys, and that biometric information stays on the device and is never sent to a remote server.
See also Phishing for why this matters.
What NIST now says about passwords
NIST's current digital identity guidance (SP 800-63B-4) uses plain rules:
| Rule | Wording |
|---|---|
| Length when the password is the only factor | At least 15 characters |
| Length when it is only one part of MFA | May be shorter, but at least 8 characters |
| Maximum length allowed | Should permit at least 64 characters |
| Composition rules | Must not require mixes of character types |
| Forced periodic changes | Must not require changing passwords periodically |
| Blocklist | Must check new passwords against a list of known common or compromised ones |
OWASP's Authentication Cheat Sheet gives matching advice and adds practical points: show the same generic error whether the username or the password was wrong (so attackers cannot test which usernames exist), allow all characters including spaces and Unicode, authenticate only over TLS, and limit repeated guessing with lockout or throttling. Passwords themselves must be stored using strong, adaptive, salted hashing such as Argon2, scrypt or PBKDF2, as OWASP's A04 guidance says.
After login: the session
Authenticating every request with a password would be impractical, so after a successful login the server creates a session and gives the browser a session ID, normally in a cookie. From then on the cookie is what identifies you (see Cookies in Computer and Networking Basics). That makes the session ID as valuable as the password, so OWASP's Session Management Cheat Sheet asks for:
- Session IDs with at least 64 bits of entropy, containing no meaningful or personal data.
- Cookies with Secure, HttpOnly and a SameSite setting (see CSRF).
- A new session ID after login and after any privilege change.
- Server-side invalidation at logout, plus idle and absolute time limits.
- Session IDs never placed in URLs.
4. Authorization in detail
Once the system knows who you are, it must decide what you may do. This is access control, and it is based on rules.
Principles that apply everywhere
| Principle | Meaning |
|---|---|
| Least privilege | NIST: "Each entity is granted the minimum system resources and authorizations that the entity needs to perform its function." |
| Deny by default | OWASP: access must be explicitly allowed, not assumed. New features should start closed |
| Check on every request | OWASP: an attacker only needs to find one request where the check is missing |
| Enforce on the server | Never trust the client to enforce permissions (see Broken Access Control) |
| Cover everything | Static files and cloud storage need rules too, not just dynamic pages |
Common models
| Model | How the decision is made | Notes |
|---|---|---|
| Role-based access control (RBAC) | Permissions are assigned to roles, and users are assigned roles. NIST: "each user is assigned one or more roles, and each role is assigned one or more privileges" | Simple and widely used. NIST's RBAC model became an American national standard (ANSI/INCITS 359-2004). Roles can become too coarse, or multiply |
| Attribute-based access control (ABAC) | NIST SP 800-162: requests to perform operations on objects are granted or denied "based on assigned attributes of the subject, assigned attributes of the object, environment conditions, and a set of policies that are specified in terms of those attributes and conditions" | Finer-grained: it can include things like time of day or department. OWASP's cheat sheet recommends ABAC and relationship-based control over plain RBAC for flexibility |
| Relationship-based access control (ReBAC) | Access depends on the relationship between the user and the object (for example "owner of this document") | Mentioned by OWASP alongside ABAC |
| File permissions (Linux) | The owner, group and everyone-else permission bits on each file | A simple authorization model you can see directly. See Linux Fundamentals |
A useful rule when you design: "may this user do this action on this specific object?" is the real question. "Is this user an admin?" is only part of it, which is why IDOR happens.
5. Side by side
| Authentication | Authorization | |
|---|---|---|
| Question | Who are you? | What may you do? |
| Based on | Evidence: factors (password, key, biometric) | Rules: roles, attributes, ownership, policies |
| When | At login, and again for sensitive actions | On every request to a protected resource |
| Order | First | Second, using the result of the first |
| Result | An identity (and a session) | Allow or deny |
| Typical technologies | Passwords, MFA, passkeys, certificates, SSO login | RBAC, ABAC, ACLs, permission checks in code, scopes in OAuth |
| User sees | A sign-in screen | "You do not have access" |
| Failure means | Someone else can pass as you (or as anyone) | A user can do or see more than they should |
| Typical attack | Credential stuffing, phishing, session theft | Changing an ID in a URL, calling an admin function directly, privilege escalation |
| OWASP Top 10:2025 | A07 Authentication Failures | A01 Broken Access Control |
Neither can substitute for the other. A strong login with sloppy permissions lets every authenticated user see everyone's data. Tight permissions with a weak login lets an attacker walk in as an administrator by guessing one password.
6. How the web shows the difference
HTTP 401 and 403
HTTP has a built-in framework for authentication, defined in RFC 9110. Its two status codes are the clearest place to see both ideas, and their names confuse people.
| Code | What RFC 9110 says | Plain reading |
|---|---|---|
| 401 Unauthorized | The request "lacks valid authentication credentials for the target resource". The server must send a WWW-Authenticate header with a challenge |
"I do not know who you are (or I do not accept the credentials you gave). Authenticate." Despite the word "Unauthorized", it is about authentication |
| 403 Forbidden | "The server understood the request but refuses to fulfill it." If credentials were provided, "the server considers them insufficient to grant access". The client should not repeat the request with the same credentials | "I know who you are, or it does not matter, and the answer is no." This is authorization |
RFC 9110 adds that a server that wishes to "hide" the existence of a forbidden resource may answer 404 instead, and that a request might be forbidden for reasons unrelated to the credentials. That is why well-designed applications sometimes answer 404 for objects you may not see.
The header used to send credentials is also oddly named: the Authorization header "allows a user agent to authenticate itself", according to the same RFC. So the Authorization header carries authentication information.
A look at Basic authentication
The simplest scheme, Basic (RFC 7617), joins the user name and password with a colon and encodes the result with Base64. For alice and s3cret the client sends:
Authorization: Basic YWxpY2U6czNjcmV0
Decode that Base64 and you get alice:s3cret straight back. Base64 is an encoding, not encryption. RFC 7617 says Basic is not considered secure unless used with an external secure system such as TLS, because the password otherwise crosses the network in clear text. You can see the challenge for yourself against a public test service:
curl -i https://httpbin.org/basic-auth/alice/s3cret
(Windows 10 and 11 include curl. In Windows PowerShell type curl.exe, because there curl is an alias for a different command, Invoke-WebRequest.)
The reply is 401 with WWW-Authenticate: Basic realm="Fake Realm". Adding -u alice:s3cret supplies the credentials.
OAuth 2.0 and OpenID Connect
These two are often confused, and the confusion is exactly authentication versus authorization.
| OAuth 2.0 | OpenID Connect (OIDC) | |
|---|---|---|
| Purpose | Per RFC 6749, an authorization framework that "enables a third-party application to obtain limited access to an HTTP service" | "A simple identity layer on top of the OAuth 2.0 protocol". It lets clients "verify the identity of the End-User based on the authentication performed by an Authorization Server" |
| Question answered | What is this app allowed to do on the user's behalf? | Who is the user that just signed in? |
| Main token | Access token (permission to call an API) | ID token, a JSON Web Token containing claims about the sign-in and the user |
| Example | "Let this calendar app read my contacts, but nothing else" | "Sign in with your account" on another site |
The practical rule: an OAuth access token says what the holder may do, not who they are. If you need to log a person in, use OpenID Connect (or another real authentication method), not a bare OAuth token. OAuth's own roles show the link between the two ideas: the authorization server issues tokens "after successfully authenticating the resource owner and obtaining authorization".
7. When each one fails
| What happened | Which failed |
|---|---|
| An attacker logs in with passwords leaked from another site (credential stuffing) | Authentication |
| An attacker tries thousands of passwords on one account, or one password on thousands | Authentication (Brute Force vs Password Spraying) |
| A user is tricked into typing their password and code on a fake page | Authentication (Phishing) |
| A session ID is stolen or guessed, or never invalidated at logout | Authentication / session management |
A logged-in user changes acct=1001 to acct=1002 in the URL and sees someone else's account |
Authorization (OWASP's own A01 example) |
A normal user opens /admin by typing the address, because only the menu hid it |
Authorization |
| A normal user gets administrator rights through a bug | Authorization (Privilege Escalation) |
| A login page tells you "that user does not exist" | Authentication (user enumeration; OWASP asks for generic messages) |
| An API accepts any valid token without checking the token's permitted scope | Authorization |
OWASP describes A07 as an attacker tricking the system into treating an invalid or incorrect user as legitimate, and A01 as users acting outside their permissions or limits. They are different bugs with different fixes, and a system needs both fixed.
8. A practical checklist
For users
- Turn on MFA everywhere it is offered, preferring passkeys or a hardware key. Any MFA is better than none.
- Use a password manager and a unique, long password for every account (NIST: at least 15 characters if a password is the only factor).
- Treat any login prompt you did not expect with suspicion, and never type a code someone asks for on the phone.
For developers and administrators
- Do authentication with proven libraries or an identity provider, not your own invention.
- Offer phishing-resistant MFA, especially for administrators.
- Follow the NIST password rules: length, blocklist, no composition rules, no forced rotation.
- Store passwords with Argon2, scrypt or PBKDF2, and use TLS everywhere.
- Treat session IDs as secrets, renew them at login, and invalidate them at logout.
- Do authorization on the server, on every request, deny by default, and tie every object to its owner.
- Give each account least privilege, and give administrators separate accounts for admin work.
- Use OIDC for sign-in and OAuth scopes for API permissions, and check scopes on the server.
- Log failed logins and denied requests, and alert on patterns (see OWASP A09 in the Top 10 overview).
- Test both: try wrong passwords, expired sessions, and requests from a second account for objects that belong to the first.
9. Common mistakes
| Myth | The facts |
|---|---|
| "Authentication and authorization are the same thing" | One proves identity. The other decides permissions |
| "If the user is logged in, they can do it" | Logged in only means authenticated. The server still has to check permission |
| "401 means the user lacks permission" | 401 is about missing or invalid credentials. 403 is a refusal |
| "The Authorization header is for authorization" | RFC 9110 defines it as the way a client authenticates itself |
| "Base64 hides the password in Basic auth" | It is an encoding. Anyone can decode it, so use TLS |
| "An OAuth access token proves who the user is" | It says what the holder may do. Use OpenID Connect for identity |
| "MFA means any second step" | The factors must be different, and SMS or plain push can be bypassed. Prefer FIDO |
| "Strong passwords need symbols and monthly changes" | NIST says length and blocklists matter, and forbids composition rules and forced rotation |
| "An admin role proves the admin is who they claim" | A role grants permissions. It says nothing about identity. A stolen admin login gives all of them |
| "If the button is hidden, the action is blocked" | Hiding is not authorization. The server must refuse the request |
| "Hash and salt make logins safe" | They protect the stored passwords. They do not stop phishing, guessing or missing permission checks |
Closing
Authentication answers "who are you?" and authorization answers "what may you do?". The first uses evidence such as passwords, keys and biometrics, and is strongest when it uses phishing-resistant methods like passkeys. The second uses rules such as roles, attributes and ownership, and is strongest when it denies by default, applies least privilege, and runs on the server for every request. HTTP expresses the split in 401 and 403, and OAuth and OpenID Connect express it for modern sign-in. When you analyse any incident, ask which of the two broke.
Keep these points:
- Authentication = identity. Authorization = permission. In that order.
- MFA needs two different factors. Prefer passkeys or hardware keys, which resist phishing.
- NIST password rules: 15+ characters when alone, a blocklist, no composition rules, no forced changes.
- Sessions carry the login, so protect session IDs like passwords.
- Authorization: least privilege, deny by default, check every request on the server.
- 401 asks for authentication. 403 refuses. The
Authorizationheader carries authentication data. - OAuth is for authorization. OpenID Connect is for sign-in.
- A07 and A01 are different failures, and both must be fixed.
Related: the "least privilege" and "deny by default" rules here are two of the classic Security Design Principles. On Windows, the access token created at sign-in is how authentication is carried into every later authorization check; see Operating Systems and Windows Basics.