STAGE 05 / LESSON 03
OAuth 2.0 and OpenID Connect
OAuth delegates access; OpenID Connect adds an identity layer on top.
THE IDEA
Understand it.
OAuth 2.0 defines roles and flows for granting a client limited access to a resource. An access token is for calling a protected resource; it is not automatically proof of a user’s identity to every application.
OpenID Connect (OIDC) adds identity information, including an ID token for the client. Use a maintained library and follow the provider’s current guidance, including authorization code flow with PKCE where applicable.
SEE IT IN CONTEXT
Sign-in at a high level
App → redirects user to identity provider
User → authenticates and authorizes
App ← authorization code
App → exchanges code and validates returned tokensThe exact exchange depends on the client type and provider; validate the tokens and expected claims rather than merely decoding them.
LEARN FROM REAL WEBSITES
See it in the real world.
These simplified structures come from public sources. Company systems change, and the sources may describe only one project or an earlier design.
Spotify
Documentation checked November 2026Authorize an app with PKCE
Spotify documents the authorization code flow with PKCE for applications accessing its Web API.
- Application
- User authorization
- Authorization code + PKCE
- API access token
What to learn: OAuth grants scoped access to an API; PKCE helps protect the authorization code exchange.
Read the source: Spotify authorization code with PKCESign in with OpenID Connect
Google documents an OpenID Connect flow in which an application receives and verifies an ID token.
- Application
- Google sign-in
- ID token
- Verified identity
What to learn: OpenID Connect adds an identity layer to OAuth; an ID token is for identity, not a substitute for every API access token.
Read the source: Google OpenID ConnectTRY IT YOURSELF
Practice.
Which protocol adds an identity layer on top of OAuth 2.0?
Show one possible answer
OpenID Connect. OAuth focuses on delegated authorization; OIDC defines identity-related behavior on top of it.
GO DEEPER