Skip to main content
Lexicon
Lexicon

OAuth 2.0

Difficulty: Intermediate
4 min read

In plain English

Plain definition

OAuth 2.0 is an authorization framework that lets one application obtain limited, scoped access to a user's resources hosted by another service, without that application ever seeing the user's password.

Technical Definition

OAuth 2.0 defines four cooperating roles: the resource owner (the user), the client (the application requesting access), the authorization server (which authenticates the resource owner and issues tokens), and the resource server (which hosts the protected resource and accepts the token). Access is granted through one of several defined grant types — most commonly the authorization code grant, strengthened with Proof Key for Code Exchange (PKCE, RFC 7636), which current best practice (RFC 9700) recommends for all clients, or the client credentials grant for machine-to-machine access. The client presents a bearer access token to the resource server; the token carries defined scopes that bound what the client may do, and it is typically short-lived, with a longer-lived refresh token used to obtain replacements without repeating user interaction. The framework itself is specified in RFC 6749, with bearer token usage in RFC 6750; engineers should check any applicable errata against the current published text before treating a specific clause as authoritative.

Operational Relevance

OAuth 2.0 sits on the critical path of almost every API integration, single sign-on flow and third-party data-sharing agreement a platform team supports. Getting a workflow wrong is rarely silent: a misconfigured redirect URI, an overly broad scope, or a token that outlives its intended use produces one of the most common categories of access-control incident. Because tokens function as bearer credentials, capturing one in a log, browser history or misconfigured cache is operationally equivalent to leaking a password for the scope it covers. Treat token issuance, storage and expiry as security-relevant configuration, not as an implementation detail delegated silently to a library default.

Architecture Relationship

OAuth 2.0 provides authorization; it deliberately does not define how a user proves identity to the authorization server, and it does not itself issue an identity assertion about the resource owner. Systems that need to know who the user is layer OpenID Connect on top of the same authorization-server infrastructure, adding an ID token alongside the access token. In production architectures, the authorization server is frequently a shared identity platform that also handles authentication, multi-factor enforcement and consent, while resource servers behind an API gateway validate incoming access tokens against that same trust anchor. Scopes and audience restrictions on the token are the mechanism by which the wider architecture keeps a compromised client bounded to a known set of resources rather than the whole estate.

Example

A bounded example workflow: a first-party web application needs read-only access to a user’s calendar data hosted by a separate API. The application redirects the user to the authorization server with a requested scope of calendar.read and a PKCE code challenge. After the user authenticates and consents, the authorization server returns an authorization code to a pre-registered redirect URI. The application exchanges that code, together with the PKCE code verifier, for a short-lived access token and a refresh token. The application presents the access token to the calendar API on each request; the API validates the token’s signature, audience and scope before returning data. When the access token expires, the application uses the refresh token to obtain a new one without prompting the user again.

Misunderstanding

The most persistent misunderstanding is treating OAuth 2.0 as an authentication protocol. Possession of a valid access token demonstrates only that the bearer was granted a scoped capability at some point before expiry; it does not, by itself, assert who the resource owner is or that they are still present. A second common error is assuming that because an access token is opaque or short-lived, it needs no additional handling care — bearer tokens still require transport encryption, storage protections and scope minimisation, because anyone holding a valid token can use it until it is revoked or expires.

  • OpenID Connect
  • Access token
  • Refresh token
  • Authorization server
  • Resource server
  • Scope
  • Proof Key for Code Exchange (PKCE)
  • Bearer token

Further Reading

For the authoritative technical text, consult RFC 6749 and the OAuth 2.0 Security Best Current Practice (RFC 9700) rather than secondary summaries, and check any active errata before relying on a clause for a production decision. Before adopting a workflow in production, validate the grant type, scope boundaries and token lifetime in an isolated or non-production environment, confirm the client’s registered redirect URIs and permissions, and define a revocation path for tokens and client credentials so that a compromised client can be contained without a wider outage.

Legacy Reference

https://oauth.net/2/

About this page

Credited to

Dates

Published

Corrections

No corrections are listed for this page. Some review sweeps corrected pages without naming each one; those are in the corrections log.

Was this useful?

Reports go to the site owner and are used to correct pages. Corrections are listed at /corrections.