OAuth 2.1: what changes and what it means for your integration
If you learned OAuth from the 2012 RFC 6749 and a handful of blog posts, your mental model is probably a decade out of date. The core framework shipped with four grant types, an optional security extension, and a long appendix of "you could also do it this way." Attackers spent the intervening years reading that appendix. OAuth 2.1 is the response: it collapses the accumulated security Best Current Practice into the baseline, removes the flows that kept producing CVEs, and makes the one extension everyone should have been using mandatory.
Nothing in OAuth 2.1 is new if you have been following the working group. That is the point. It is a consolidation, not an invention, which means the migration is mostly about deleting code paths you should no longer support rather than building anything.
PKCE is now mandatory for every authorization code flow
Proof Key for Code Exchange (RFC 7636) was originally sold as a fix for public clients — mobile and single-page apps that cannot keep a secret. OAuth 2.1 requires it for all clients using the authorization code grant, including confidential server-side clients that also present a secret.
The reason is the authorization code injection attack. If an attacker can intercept an authorization code — through a redirect leak, a logging mistake, or a malicious app registered on a custom URI scheme — they can redeem it at the token endpoint. PKCE closes this by binding the code to a secret the client generates per request.
GET /authorize?response_type=code
&client_id=app-7f2
&redirect_uri=https://app.example.com/callback
&scope=openid%20profile
&state=xyz
&code_challenge=E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM
&code_challenge_method=S256 HTTP/1.1
Host: auth.example.comThe client stores a random code_verifier and sends only its SHA-256 hash (code_challenge) to the authorization endpoint. At the token endpoint it reveals the verifier; the server recomputes the hash and rejects the exchange if it does not match. A stolen code is useless without the verifier, which never left the client.
S256, never plain. The plain method sends the verifier as the challenge, which defeats the purpose on any channel an attacker can read. OAuth 2.1 permits plain only when the client literally cannot compute SHA-256 — which in practice is never. Configure your server to reject plain outright.The implicit flow is gone
The implicit grant (response_type=token) returned an access token directly in the redirect URI fragment, skipping the token endpoint. It existed because browsers once could not make cross-origin requests to a different domain. CORS fixed that years ago, and the flow's downsides never did: tokens landed in browser history, in Referer headers, and in server logs, with no way to authenticate the client and no refresh tokens.
OAuth 2.1 removes it entirely. Single-page apps should use the authorization code flow with PKCE. Yes, that means an extra round trip to the token endpoint. It also means the access token never appears in a URL, you can issue refresh tokens with rotation, and you get a clean place to enforce client policy.
Refresh tokens for browser apps
With implicit gone, SPAs need refresh tokens. OAuth 2.1 requires that refresh tokens issued to public clients either be sender-constrained or use rotation: each refresh returns a new refresh token and invalidates the old one. If a rotated token is ever replayed, the server detects the reuse and can revoke the entire chain — a strong signal that the token was stolen.
The resource owner password credentials grant is removed
The password grant let a client collect a username and password directly and trade them for a token. It was always a compromise for migrating legacy apps, and it is incompatible with everything modern auth depends on: MFA, passkeys, federated login, and the simple principle that your application should never see the user's password. OAuth 2.1 drops it. If you still have a password-grant code path, treat its removal as a security win, not a regression.
Redirect URI matching gets stricter
{
"client_id": "app-7f2",
"redirect_uris": [
"https://app.example.com/callback",
"https://app.example.com/callback/silent"
],
"token_endpoint_auth_method": "private_key_jwt",
"grant_types": ["authorization_code", "refresh_token"]
}Note what is absent: no implicit, no password. A compliant registration simply cannot express them.
What you actually need to change
For most teams the migration is a short checklist rather than a rewrite:
- Add PKCE to every authorization code client, including confidential ones, and require
S256server-side. - Delete implicit-flow clients and move SPAs to code + PKCE with rotating refresh tokens.
- Remove any resource owner password credentials usage. Migrate those integrations to the device code flow or a proper browser redirect.
- Tighten redirect URI registration to exact matches and audit for any prefix wildcards.
- Prefer
stateand PKCE together;statestill carries your CSRF protection and application context even though PKCE now also binds the request.
The spec is a floor, not a ceiling
OAuth 2.1 is deliberately conservative — it standardizes what the security community already agreed on. Beyond it sit the extensions worth adopting once the baseline is solid: Pushed Authorization Requests to keep parameters off the front channel, DPoP or mTLS to bind tokens to a client, and resource indicators to scope tokens to a single API. OAuth 2.1 gets you to a defensible starting point; those extensions harden it against the attacks that specifically target your threat model.
The deeper reason to track this spec closely is ownership. When you run your own authorization server, you decide when to enforce PKCE, which grants to disable, and how aggressively to rotate refresh tokens — and you can turn the knobs the day a new attack class appears rather than waiting on a vendor's roadmap. Owning your auth means the floor OAuth 2.1 defines is yours to raise whenever you choose.
Run it yourself
Bastionary is free, open-source software. Follow the quick start to have it running on your own server, or browse the releases on Git.