OAuth 2.0 Flow Visualizer
Understand every OAuth 2.0 grant type through interactive step-by-step flows. See the exact HTTP requests, response payloads, and parameters for Authorization Code, Client Credentials, Device Code, and the deprecated Implicit flow — with PKCE, tokens, and security notes explained.
Frequently Asked Questions
What is the difference between OAuth 2.0 and OpenID Connect (OIDC)?▼
OAuth 2.0 is an authorization framework — it answers 'can this app access this resource on behalf of the user?' It deals in access tokens scoped to specific resources. OpenID Connect (OIDC) is an identity layer built on top of OAuth 2.0 — it answers 'who is this user?' by adding an ID token (a JWT) containing the user's profile. When you see a scope like 'openid profile email', the openid scope triggers OIDC and the auth server returns an id_token in addition to the access_token. Use OAuth alone for delegated API access; add OIDC when you need authentication (login) as well.
What is PKCE and do I always need it?▼
PKCE (Proof Key for Code Exchange, RFC 7636) prevents authorization code interception attacks. Before redirecting, the client generates a random code_verifier, hashes it to produce a code_challenge, and sends the challenge to the auth server. When exchanging the code for tokens, the client sends the original code_verifier — the server verifies they match. Without PKCE, a malicious app on the same device could intercept the authorization code from the redirect and exchange it for tokens. PKCE is required for public clients (SPAs, mobile apps) and strongly recommended for confidential clients too. OAuth 2.1 (the upcoming simplified spec) mandates PKCE for all Authorization Code flows.
When should I use Client Credentials vs Authorization Code?▼
Use Client Credentials when there is no human user involved — your backend service, cron job, or microservice needs to call another API. The service authenticates as itself using its client_id and client_secret. Use Authorization Code when a human user is authorizing access — they need to log in and approve the scopes. The key question is: 'Is there a user who needs to consent?' If yes → Authorization Code. If no → Client Credentials.
How should I store access tokens and refresh tokens securely?▼
Access tokens used in SPAs should be stored in memory (JavaScript variable) — not localStorage or sessionStorage, which are vulnerable to XSS. For web apps with a backend, store the refresh token in an HttpOnly, Secure, SameSite=Strict cookie and issue short-lived session cookies to the browser. Never store sensitive tokens in localStorage. In mobile apps, use the platform's secure storage (iOS Keychain, Android Keystore). Refresh tokens must be treated like passwords — rotate them on use (refresh token rotation) and invalidate old ones immediately.
What happens when an access token expires?▼
When an API returns 401 Unauthorized, the client should check if it has a valid refresh token. If it does, it sends a POST /token request with grant_type=refresh_token and the refresh_token value. The auth server validates the refresh token and returns a new access_token (and often a new refresh_token — refresh token rotation). If the refresh token is also expired or revoked (e.g. user logged out, password changed, suspicious activity), the client must send the user back through the authorization flow from the beginning. Always implement token refresh logic before building any OAuth-protected feature.
Related Products
on GumroadDevToolkit Starter Kit
A ready-to-deploy developer tools website with 12 built-in tools. Astro + Preact + Tailwind. Deploy to Cloudflare Pages for free. Built-in SEO, dark mode, and ad-ready layout.
Buy on Gumroad →TypeScript Quick Reference Toolkit
5 practical reference files for TypeScript developers: cheatsheet, TS vs JS comparison, 20 utility types with real examples, tsconfig best practices template, and 15 common mistakes guide. Print it. Keep it on your desk.
Buy on Gumroad →Developer Productivity Bundle
Stop rebuilding the same setup every project. 51 VSCode snippets, 40 Git aliases, 5 Docker Compose stacks, 5 GitHub Actions workflows, 5 README templates, and a dotfiles kit. Set up a professional dev environment in under an hour.
Buy on Gumroad →You Might Also Need
OpenAPI Validator
Paste your OpenAPI 3.x spec (YAML or JSON) to validate structure, find missing required fields, detect duplicate paths, check for missing operationIds, and get errors and warnings with path references.
Open free tool →
API Response Mock Generator
Generate realistic mock API responses with custom status codes, headers, and JSON body. Quick templates for 200, 401, 404, 429, 500 and more. Runs in your browser.
Open free tool →
API Response Time Tester
Test API endpoint response times directly from your browser. Run multiple requests, see average/min/max times, status codes, and response sizes. GET, POST, PUT, DELETE support. Free.
Open free tool →
More Free Tools
Related Articles
JWT Authentication Best Practices 2026: Secure Your API Tokens
Complete JWT security guide for 2026. Covers RS256 vs HS256 signing, token storage strategies, expiry and refresh token patterns, revocation, common vulnerabilities, and a production security checklist.
JWT Token Decoder: How to Debug Authentication Issues
Learn how to use a JWT token decoder to diagnose 401 errors, expired tokens, missing claims, and auth misconfiguration. Practical debugging guide with code examples.
JWT Tokens Explained: How to Decode and Debug Them
Understand JSON Web Tokens from header to signature. Learn how to decode JWTs, read their claims, debug authentication issues, and use free online JWT tools.
Web Authentication Patterns in 2026: OAuth, Passkeys, and JWT Best Practices
A complete guide to modern web authentication: OAuth 2.0/OIDC, Passkeys/WebAuthn, JWT best practices, session management, and MFA strategies for secure apps.
Base64 Encode/Decode Explained: When and How to Use It
Understand when to use Base64 encoding and when to avoid it. This guide explains the Base64 algorithm, practical use cases, code examples in JavaScript, Python, Go, and more.
Enjoying this tool? Get more like it.
Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.
Unlock AI-Powered Dev Tools
- ⚡ AI Code Review, Doc Generator & SQL Builder
- ⚡ All premium templates & early access
- ⚡ Member discounts on Gumroad products
$9/mo after trial · Cancel anytime
Want the full toolkit?
Get DevPlaybook Pro
Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.
MIT licensed · Instant download · No subscription
See what's included → Browse all deals →