Foundational

OAuth 2.0 in plain language

Understand delegated API access, the main actors, and the role of access tokens.

OAuth 2.0 is an authorization framework. It lets a client obtain limited access to a protected resource. It is not, by itself, a protocol for establishing an end user’s identity to a client.

The actors

ActorResponsibility
Resource ownerCan authorize access to a protected resource.
ClientRequests access and uses a token.
Authorization serverProcesses authorization and issues tokens.
Resource serverHosts the protected API and validates access.

An organization might operate several of these roles in one service. Their responsibilities remain distinct.

An illustrative authorization-code interaction

  1. A document-printing application redirects a user to the authorization server with a narrowly defined access request.
  2. The server handles authentication and authorization according to its policies.
  3. The browser returns an authorization code to the registered client callback.
  4. The client exchanges the code and the required proof for tokens.
  5. The client presents an access token to the document API.

PKCE binds the authorization request to a code verifier presented at the token endpoint. It helps protect against authorization-code interception and injection attacks; it does not replace every other required validation.

Scopes and enforcement

A scope such as documents.read describes requested or granted access according to the API’s contract. The resource server still needs to check the token’s validity and the actual resource and action.

A token for document reading must not become permission to read every tenant’s documents simply because the scope has the same name.

Access tokens can be opaque or structured. Their format is a deployment choice; clients should not assume every access token is a JWT.

Use current security guidance

Use maintained protocol libraries and the applicable security profile. The OAuth Security BCP advises against the implicit grant and prohibits use of the resource owner password credentials grant. Exact redirect URI handling, PKCE, token protection, and client type all matter.

For application sign-in, continue with OpenID Connect. For software acting without a user, see workload access.

Go deeper

TopicArticle
Which grant and which client authentication to useGrant types and clients
What each authorization server endpoint doesAuthorization server endpoints
How clients and APIs discover each otherDiscovery and metadata
What is inside a tokenToken claims and self-contained vs. opaque tokens
How an API should accept tokensProtecting an API as a resource server
Binding tokens to the clientDPoP
Protecting and enriching the authorization requestPAR and JAR, RAR
Device flow, token exchange, mTLS, OAuth 2.1Advanced OAuth
What can go wrongThreats and mitigations
Browser and mobile architecturesBackend for frontend, native and mobile apps

References

Knowledge is better when it is shared.Improve this page

Type to search the entire handbook.