liveBook · Manning

OAuth

As explained in Secure APIs

OAuth 2.0 is the earlier major version of the OAuth authorization framework that defined multiple authorization flows for delegated access.

OAuth 2.0 delegates access without requiring an application to receive a user’s password. It limits access by combining an authorization flow, requested scopes, and time-limited access tokens. section 7.3

OAuth authorization flows use four roles and several flow types:

  • The resource owner controls the data, the client requests access, the authorization server authenticates users and issues tokens, and the resource server stores data and enforces access. section 7.3
  • Authorization code exchanges a code for a token; client credentials obtains tokens directly for programmatic access such as microservices; device authorization supports input-constrained devices; refresh tokens renew expired access. section 7.8
  • Scopes specify permitted data and operations, while access tokens carry access for a limited period and within those requested scopes. section 7.3

Importing a LinkedIn profile

A job portal should not ask for LinkedIn credentials, because those credentials could give it unrestricted account access. Instead, the user authorizes limited employment-history access, and the portal receives a scoped, temporary access token. section 7.3

Figure 7.5 OAuth describes flows through which users (resource owners) can authorize applications (clients) to access their data in an API (resource server). Every flow begins with an authorization request, followed by user login and consent and then by an access token grant.
figure

Use the flow diagram to follow authorization request, user login and consent, and access-token grant. section 7.3

How Secure APIs covers it

How deep it goes
Explains roles, scopes, tokens, and four flows, then adds PKCE and sender-constrained-token protections without implementation code.
Examples
Uses a job portal importing LinkedIn employment history and identifies microservices and smart TVs as flow-selection scenarios.
What it assumes
Assumes basic API access concepts while defining authentication, authorization, resource roles, scopes, and tokens.
What you can do after
Apply OAuth by selecting a flow, requesting scopes, and using time-limited access tokens for delegated API access.
How it connects
Connects delegated access with authentication, authorization, scopes, access tokens, PKCE, JWTs, and OpenID Connect.

Also explained in

Compare how 9 books explain OAuth →

Related concepts

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