Okay, let's break down the key differences between OAuth 2.0 and the proposed OAuth 2.1.
It's crucial to understand that OAuth 2.0 (RFC 6749) is a framework, not a rigid protocol. Over time, best practices emerged, extensions were created (like PKCE), and security vulnerabilities were identified in some original grant types.
OAuth 2.1 is an Internet-Draft aiming to consolidate and codify these best practices, simplify the framework, and deprecate insecure options from OAuth 2.0. It's essentially OAuth 2.0 + Security Best Current Practices (BCP) + PKCE - insecure legacy parts.
As of late 2023 / early 2024, OAuth 2.1 is still a draft and not a finalized RFC standard. However, it represents the direction the industry and the IETF working group are heading.
Here are the main differences highlighted in the OAuth 2.1 draft compared to the original OAuth 2.0 specification (RFC 6749) and its associated Bearer Token Usage specification (RFC 6750):
-
PKCE (Proof Key for Code Exchange) is Mandatory:
- OAuth 2.0: PKCE (RFC 7636) was introduced later as an extension, primarily for public clients (like mobile and single-page apps) to prevent authorization code interception attacks. It became recommended best practice even for confidential clients.
- OAuth 2.1: PKCE is required for all clients (both public and confidential) using the Authorization Code grant. This significantly enhances the security of the most commonly used flow.
-
Redirect URIs Must Use Exact Matching:
- OAuth 2.0: Allowed for partial matching, wildcards, or schemes in redirect URI registration, which could lead to vulnerabilities (e.g., open redirectors) if not implemented carefully.
- OAuth 2.1: Mandates that redirect URIs provided in the authorization request must exactly match one of the pre-registered URIs (using simple string comparison).
-
Implicit Grant (response_type=token) is Deprecated:
- OAuth 2.0: Defined the Implicit grant, which directly returns the access token in the redirect URI fragment.
- OAuth 2.1: Removes the Implicit grant. It's considered insecure because access tokens are exposed via the browser history and potentially leaked via Referer headers. The combination of Authorization Code + PKCE provides a more secure alternative for browser-based and native apps.
-
Resource Owner Password Credentials (ROPC) Grant is Deprecated:
- OAuth 2.0: Defined the ROPC grant where the client directly handles the user's username and password.
- OAuth 2.1: Removes the ROPC grant. This grant discouraged the core principle of delegation (users shouldn't share passwords with third-party apps) and increased the application's attack surface. It was only intended for legacy or specific trusted scenarios.
-
Bearer Tokens in URI Query Parameters are Disallowed:
- OAuth 2.0 (Bearer Token Usage - RFC 6750): Allowed bearer tokens to be sent in the
Authorization: Bearer header, the request body (form-encoded), or the URI query string (access_token=...).
- OAuth 2.1: Forbids sending bearer access tokens in the URI query string. This prevents tokens from leaking via browser history, server logs, and Referer headers. Sending tokens in the
Authorization header remains the standard method.
-
Refresh Token Rotation or Sender Constraints are Required:
- OAuth 2.0: Refresh tokens could potentially be long-lived and static. Refresh token rotation was later recommended as a best practice (OAuth 2.0 Security BCP).
- OAuth 2.1: Mandates that refresh tokens must either be rotated upon each use (the old refresh token is invalidated, and a new one is issued alongside the new access token) OR be sender-constrained (e.g., bound to the client's TLS certificate) to prevent misuse if leaked.
-
Simplification and Clarity:
- OAuth 2.0: Being a framework, it left room for interpretation and required consulting multiple RFCs and BCPs for a secure implementation.
- OAuth 2.1: Aims to be a more self-contained specification by incorporating necessary security practices directly, making it easier to implement securely. It consolidates guidance from the core spec, PKCE, Bearer Token Usage, and the Security BCP.
In Summary: OAuth 2.1 isn't a radical departure but a focused update that mandates current security best practices (like PKCE), removes known insecure grant types (Implicit, ROPC), and tightens rules (exact redirect URIs, no tokens in query strings, refresh token handling) to create a simpler, more secure baseline for developers.
References and Citations:
-
OAuth 2.0 Core Specification:
-
OAuth 2.0 Bearer Token Usage:
-
Proof Key for Code Exchange (PKCE):
-
OAuth 2.0 Security Best Current Practice:
- Lodderstedt, T., Ed., Bradley, J., Labunets, A., & Fett, D. (June 2021). OAuth 2.0 Security Best Current Practice. RFC 8977 (updates some aspects, but the BCP document itself is often referenced directly). The latest draft is usually cited:
draft-ietf-oauth-security-topics.
- Current Draft: Lodderstedt, T., Ed., Bradley, J., Labunets, A., & Fett, D. (Ongoing Draft). OAuth 2.0 Security Best Current Practice. Internet-Draft
draft-ietf-oauth-security-topics. IETF. Retrieved from https://datatracker.ietf.org/doc/html/draft-ietf-oauth-security-topics (Check for latest version).
-
OAuth 2.1 Draft Specification:
- Current Draft: Parecki, A., Ed., Sakimura, N., Ed., & Lodderstedt, T., Ed. (Ongoing Draft). OAuth 2.1 Authorization Framework. Internet-Draft
draft-ietf-oauth-v2-1. IETF. Retrieved from https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1 (This URL points to the latest version; specific draft versions have numbers, e.g., draft-ietf-oauth-v2-1-09).
Remember to always check the IETF DataTracker for the most current versions of Internet-Drafts, as they are subject to change.