Academy / Authentication / Identity
← Back

Authentication / Identity

IAM, OAuth 2.0, OIDC, OBO, SAML, la de dah...
Authentication & IAM
Time period
1990s to present
Field
Security!
Famous standards
OAuth 2.0, OpenID Connect (oidc), SAML 2.0, JWT, WebAuthn
Main idea
Prove who ya are: authentication, tell ya what you can do: authorization, without using a password all over. Its trust dude!
Related
Modern AI Concepts agents need to authenticate to tools. this is friggen huge rn

IAM (Identity and Access Management) is how systems answer two HUGE questions: who are you (authentication, "AuthN"), and what are you allowed to do (authorization, "AuthZ"). This article will answer those questions.

Contents
  1. Authentication vs. authorization
  2. Sessions / cookies
  3. API keys / basic auth
  4. OAuth 2.0
  5. OpenID Connect (OIDC)
  6. JWTs
  7. On-Behalf-Of (OBO) / token exchange
  8. SAML
  9. Mutual TLS (mTLS)
  10. Passkeys / WebAuthn
  11. When to use what?
  12. Glossary
  13. References

1. Authentication vs. authorization

Authentication proves who you are, which is your identity. It can be a password, a passkey, a certificate or something else. Authorization decides what you can do once you are authenticated. Can you read a file, install doom/minecraft, browse a sus webpage on a school computer. All of the online world is gated by these two concepts, and a lot of confusion comes from mixing them up: OAuth 2.0, for instance, is an authorization framework, not an authentication protocol. Duh. OIDC (§5) had to be built on top of it to pass claims and stuff that allow you to be authorized to do things.

2. Sessions / cookies

The classic pattern: the user logs in with a password, the server then creates a session and hands the browser a cookie which contains a session ID. The browser sends that cookie back with every request; the server looks it up to know who's asking.

3. API keys / basic auth

An API key is a long standing static secret string that is sent with every request, to identify the calling application. HTTP Basic Auth sends a username and password, which is base64-encoded (not encrypted), on every request.

Weakness: both are bearer secrets with no built-in expiration, scope, or revocation ability. Whoever has it has full access until it is manually rotated. THis is ok for some stuff like service-to-service calls with other protections but is surely risky if it is the only layer for anything sensitive.

4. OAuth 2.0

OAuth 2.0 is an authorization framework that lets a user grant one application limited access to their data on another service, without giving a password to the first app. It is built on trusting the identity provider (IDP).

RoleMeaning
Resource ownerThe user
ClientThe app requesting access
Authorization serverIssues tokens after the user approves
Resource serverThe API holding the user's data

The most common flow (authorization code) works like this:

1. the app will redirect the user to the authorization server's login screen. 2. The user will log in and approve the requested access. 3. The athorization server will redirect the user back to the app with a one-time code. 4. The app exchanges that code for an access token. 5. The app calls the resource server's API with the access token.

What OAuth 2.0 does not define: who the user is. It only proves the client was granted access. OIDC does the next part.

5. OpenID Connect (OIDC)

OpenID Connect is an identity layer which is built on top of OAuth 2.0 framework. It adds an ID token (a JWT, see §6) that says exactly who logged in, which is issued alongside the regular access token in the same flow.

This is the standard behind prettymuch every of the "Sign in with Google / Microsoft / Apple" buttons. The client gets both an access token to call APIs on the user's behalf and an ID token to know who the user actually is.

6. JWTs

A JWT (JSON Web Token, pronounced "jot") is s three part string of text. It has a header, claims - user ID/expiry/issuer/something else, and a signature: base64(header).base64(payload).signature.

Header: {"alg":"RS256","typ":"JWT"} Payload: {"sub":"user_123","iss":"https://auth.example.com","exp":1735689600} Signature: a cryptographic signature over the header/payload, using the private key of the issuer

Anybody can decode and read a JWT's payload; it's not encrypted or anything, just signed. The signature is what lets a resource server verify the token wasn't tampered with, without calling back to the issuer for each request.

7. Token exchange (RFC 8693) and On-Behalf-Of

RFC 8693 (OAuth 2.0 Token Exchange) is the IETF standard for a specific chained service problem: Service A holds a token proving the user authenticated to it, and now needs to call Service B as that same user, not as itself, and without the user needing to log in again. It defines a generic grant type where a client presents one token and gets back another, optionally narrowed in scope or re-targeted to a new audience, while preserving (or explicitly delegating) the original identity. This is used in AI agents a lot.

UserService A (holds token T1 for the user) Service A exchanges T1 for T2, scoped to Service B Service AService B, using T2 (still identifies the original user)

On-Behalf-Of (OBO) is Microsoft's implementation of RFC 8693 in Azure AD/Entra ID — one concrete instance of the standard, not a separate flow. Other identity providers implement the same RFC 8693 exchange under their own names, so "token exchange" is the general term to reach for; OBO is what you'll see it called if you're specifically in the Microsoft ecosystem.

Why it matters: without token exchange, a microservice chain either has to re-prompt the user at every hop or have each service impersonate the user with its own static credentials. Token exchange keeps the chain auditable and scoped.

8. SAML

SAML (Security Assertion Markup Language) is an older, XML-based alternative to OIDC that does the same thing. allows for single sign-on. This one is usually relegated to human logins. Unlike OIDC which is commonly used for both human and machine. An identity provider (IdP) issues a signed XML assertion about a user; a service provider (SP) trusts assertions from that IdP and logs the user in without a separate password. Its trust!

Super common in enterprise/corporate SSO. Think when you get logged into an app without a password on your school computer. It trusts your login to the computer itsself in that case. (it predates OAuth 2.0/OIDC and is huge in enterprise identity providers). OIDC's JSON-over-HTTP model is simpler to implement nowadays and usually works better.

9. Mutual TLS (mTLS)

Normal TLS only proves the server identity to the client. Mutual TLS does both. Both sides have to present X.509 certificates, and both will verify each other before any data moves. Common for service-to-service auth inside a private network or between organizations with a pre-established trust relationship, where there's no human around to click through a login screen.

10. Passkeys and WebAuthn

WebAuthn is a W3C standard for public-key-based login: your device generates a key pair, keeps the private key in some secure hardware (a TPM, a phone's secure enclave), and only ever sends the public key to the server. Passkeys are the consumer-facing product name for WebAuthn credentials that sync across a user's devices.

Theres no shared secret transmitted or stored server-side so this approach is actually pretty resistant to phishing and to the password-database breaches that plague the older approaches in §2–3.

11. Choosing between them

SituationTypical choice
User logging into a website/appOIDC (or passkeys directly)
App accessing a user's data on another serviceOAuth 2.0
Enterprise single sign on to corporate appsSAML
Service A calling Service B as the current user (AI Agents)OBO / token exchange (RFC 8693)
Service-to-service, no human presentmTLS or scoped API keys
Passwordless, phishing-resistant loginPasskeys / WebAuthn

See also

Glossary
Access token
A credential proving a client was granted access; presented to a resource server on each API call.
Authentication (AuthN)
Proving who you are.
Authorization (AuthZ)
telling you what an authenticated identity is allowed to do.
Bearer token
A token that grants access to the keeper/bearer, no extra proof required: like cash, not a credit card.
Claim
A single piece of information inside the payload of a token could be a group that your identity is in or some other attribute.
Identity provider (IdP)
The system that authenticates the user and issues tokens/assertions about them. The trusted one.
Scope
A named permission that a token carries, limiting what it can be used for. Read this not that.
Single sign-on (SSO)
Logging in once to access multiple things. Like logging into your school account and getting logged into Epic with no password needed. Not actually magic.
References
  1. Hardt, D., Ed. (2012). "The OAuth 2.0 Authorization Framework." IETF RFC 6749. datatracker.ietf.org/doc/html/rfc6749
  2. Sakimura, N., Bradley, J., Jones, M., de Medeiros, B., & Mortimore, C. (2014). "OpenID Connect Core 1.0." OpenID Foundation. openid.net/specs/openid-connect-core-1_0.html
  3. Jones, M., Bradley, J., & Sakimura, N. (2015). "JSON Web Token (JWT)." IETF RFC 7519. datatracker.ietf.org/doc/html/rfc7519
  4. Jones, M., Nadalin, A., Campbell, B., Eds., Bradley, J., & Ardito, C. (2020). "OAuth 2.0 Token Exchange." IETF RFC 8693: the standard generalizing On-Behalf-Of flows. datatracker.ietf.org/doc/html/rfc8693
  5. Microsoft identity platform. "Microsoft identity platform and OAuth 2.0 On-Behalf-Of flow." learn.microsoft.com: v2-oauth2-on-behalf-of-flow
  6. OASIS. (2005). "Security Assertion Markup Language (SAML) V2.0 Technical Overview." docs.oasis-open.org: saml-core-2.0-os.pdf
  7. Rescorla, E. (2018). "The Transport Layer Security (TLS) Protocol Version 1.3." IETF RFC 8446 (defines client certificate authentication, the basis of mTLS). datatracker.ietf.org/doc/html/rfc8446
  8. W3C. (2021). "Web Authentication: An API for accessing Public Key Credentials (WebAuthn) Level 2." W3C Recommendation. w3.org/TR/webauthn-2/