OAuth 2.0 Quick Guide

A practical overview of OAuth 2.0 flows, tokens, and PKCE for modern apps.

Grant Types

Key / CodeDescription
Authorization Code + PKCEBrowser/mobile apps with public clients.
Client CredentialsService-to-service access.
Device CodeInput-limited devices (TV/CLI).
Refresh TokenLong-lived session renewal.

Tokens

Key / CodeDescription
Access TokenShort-lived token used to call APIs.
Refresh TokenUsed to obtain new access tokens.
ID Token (OIDC)User identity claims (OpenID Connect).

PKCE Parameters

Key / CodeDescription
code_verifierRandom secret generated by the client.
code_challengeTransformed verifier sent to auth server.
code_challenge_methodS256 recommended.

Security Tips

Use HTTPS everywhere, validate redirect URIs, rotate refresh tokens, and use PKCE for public clients.

Choosing the Right Flow

Use Authorization Code with PKCE for browser and mobile apps, Client Credentials for machine-to-machine calls, and Device Code when the device cannot host a normal browser login. Avoid mixing flows without a clear reason, because each one implies different token storage and trust boundaries.

Knowledge is power.