Skip to main content
Web DevAuth & SecurityDiagramIntermediate

OAuth 2.0

KO: OAuth 2.0·EN: OAuth 2.0·JA: OAuth 2.0·Open Authorization 2.0

An industry-standard authorization framework that lets users grant third-party applications scoped access to their resources without sharing passwords

Table of Contents

Structure Diagram

OAuth 2.0 Authorization Code + PKCE Flow
OAUTH 2.01. Auth Requ…2. Login & C…3. Auth Code…4. Token Exc…
2/42. Login & Consent
Approve requested scopes
Quick Answer

What is OAuth 2.0?

An industry-standard authorization framework that lets users grant third-party applications scoped access to their resources without sharing passwords. It is a core concept in Auth & Security within Web Dev.

Core Principles

OAuth 2.0 is an authorization (delegated access) standard—not an authentication protocol by itself. Instead of handing your Google password to a third-party calendar app, you sign in directly with Google and grant scoped permission; the app receives a time-limited Access Token restricted to those scopes.

When apps also need to verify user identity ("Sign in with Google"), they layer OpenID Connect (OIDC) on top of OAuth 2.0 to receive a signed ID Token.

Practical Takeaways

  • Always use Authorization Code + PKCE: The legacy Implicit Flow is deprecated because tokens leak in browser URLs and history. Use Authorization Code with PKCE (code_challenge / code_verifier) across mobile, SPA, and server apps alike.
  • Validate the state parameter: Bind a cryptographic state nonce to the user's session to prevent Login CSRF attacks during the OAuth callback.
  • Request least-privilege scopes: Ask only for the scopes needed upfront and use incremental authorization when additional permissions are required later.

Notable Examples

  • Social SSO (Google, GitHub, Apple): Built on OAuth 2.0 + OIDC for passwordless federated sign-in.
  • SaaS integrations (Slack apps, Zapier, Calendar sync): Granting scoped, revocable API access to external tools.