ThoughtsInWords

Understanding OAuth 2.0

Date: June 08, 2026

Overview

OAuth 2.0 is an authorization framework that allows a client (app) to obtain limited access (tokens) to a resource server on behalf of a resource owner (user). This is achieved using an authorization server to issue tokens.

Key Actors

Core Concepts

Main Grant Types (Flows)

Authorization Code Flow Diagram

sequenceDiagram
    participant U as Resource Owner (User)
    participant C as Client (App)
    participant A as Authorization Server
    participant R as Resource Server

    U->>C: Access Application
    C->>U: Redirect to Authorization Server
    U->>A: Authenticate and Authorize
    A-->>U: Redirect to Client with Auth Code
    U->>C: Follow Redirect with Auth Code
    C->>A: Exchange Auth Code for Access Token
    A-->>C: Access Token (+ Refresh Token)
    C->>R: Request Resource with Access Token
    R-->>C: Protected Resource

Deprecated Flows

Both are discouraged and removed in OAuth 2.1 due to security risks.

Security Considerations & Best Practices

Typical HTTP Examples

Authorization Request (Browser Redirect)

GET /authorize?response_type=code&client_id=...&redirect_uri=...&scope=...&state=...

Token Exchange (Server POST)

POST /token grant_type=authorization_code&code=...&redirect_uri=... (The client authenticates) → Returns access_token, token_type, expires_in, and optionally refresh_token.

Implementation Resources

Use RFC 6749 for the protocol details, oauth.net for practical guidance and extensions (like PKCE, device flow, and OAuth 2.1 updates), and adhere to current security BCPs (Best Current Practices) when implementing.

References

  1. RFC 6749
  2. oauth.net
  3. Modern Security BCPs