M. Kodirov

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 tokens

The 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 2026

Authorize an app with PKCE

Spotify documents the authorization code flow with PKCE for applications accessing its Web API.

  1. Application
  2. User authorization
  3. Authorization code + PKCE
  4. 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 PKCE

Google

Documentation checked November 2026

Sign in with OpenID Connect

Google documents an OpenID Connect flow in which an application receives and verifies an ID token.

  1. Application
  2. Google sign-in
  3. ID token
  4. 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 Connect

TRY 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

Official references.