liveBook · Manning

OAuth

As explained in Grokking Software Architecture

A version of the OAuth authorization framework that enables delegated, token-based access to protected resources.

OAuth 2.0 is an authorization framework: it lets a user or service grant delegated access to resources through tokens, without exposing the user’s password. It answers what a client is allowed to do; OpenID Connect (OIDC) handles who the user or service is. section 11.3.2

Choose a flow for the situation:

  • Use Authorization Code Flow with PKCE when a person signs into a web or mobile app. PKCE protects the temporary login code when the app cannot safely keep a permanent client secret. section 11.3.2
  • Use Client Credentials Flow when one backend service needs to access another and no person is involved. section 11.3.2
Table 11.1 Selecting the Correct OAuth 2.0 Flow by Architectural Scenario
Scenario
Recommended OAuth 2.0 Flow
Key Characteristic
Human User logging into a web or mobile app.
Authorization Code Flow (with PKCE)
Redirects the user to a secure login page hosted by the IdP.
Backend Service talking to another service (Machine-to-Machine).
Client Credentials Flow
No humans are involved; the service uses its own ID and Secret to obtain a token.

Compare the recommended flow for human sign-in with the flow for service-to-service access. section 11.3.2

An Identity Provider (IdP) can issue tokens while centralizing identity management. In the valet-key analogy, OAuth grants permission to drive the car, not open its glovebox: access should match the task. section 11.3.2 section 11.10

How Grokking Software Architecture covers it

How deep it goes
Defines authorization, distinguishes it from authentication, and names flows and PKCE without detailing implementation steps.
Examples
Contrasts human sign-in to web or mobile apps with backend service-to-service access.
What you can do after
Evaluate whether Authorization Code Flow with PKCE or Client Credentials Flow fits a human or service access scenario.
How it connects
Connects OAuth 2.0 with OpenID Connect, Identity Providers, tokens, and API Gateways.

Also explained in

Compare how 11 books explain OAuth →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Software Architecture. The section links point to the parts of the book it draws on.