OAuth2 Flow Tester
Test and debug OAuth2 authorization code flows. Generate cryptographically secure PKCE
code_verifier and
code_challenge pairs,
build authorization URLs with correct parameters, and generate token exchange requests.
Step-by-step simulation of the complete OAuth2 + PKCE flow.
Frequently Asked Questions
What is PKCE and why is it required?▼
PKCE (Proof Key for Code Exchange, pronounced 'pixy') prevents authorization code interception attacks. The client generates a random code_verifier, computes its SHA-256 hash (code_challenge), and sends the hash with the authorization request. When exchanging the code for tokens, the client sends the original verifier. Even if an attacker intercepts the authorization code, they can't get tokens without the verifier — which was never sent in the initial request. PKCE is now required for all OAuth 2.0 public clients (RFC 9700).
What is the difference between Authorization Code and Implicit flow?▼
Authorization Code flow: the authorization server returns a short-lived code, which the client exchanges for tokens via a server-to-server request. The access token never appears in URLs. Implicit flow (now deprecated): the authorization server returns the access token directly in the URL fragment (response_type=token). Tokens in URLs are logged by browsers, proxies, and CDNs — a significant security risk. Always use Authorization Code + PKCE instead of Implicit.
What is the 'state' parameter for?▼
The 'state' parameter is a CSRF (Cross-Site Request Forgery) token. Your app generates a random value before redirecting to the authorization server, includes it in the auth URL, and verifies it matches when the user is redirected back with the authorization code. Without state validation, an attacker can initiate an auth flow and trick a victim into completing it, linking the attacker's account to the victim's identity.
What scopes should I request?▼
Request only the minimum scopes needed (principle of least privilege). For OpenID Connect: 'openid' is required for an ID token. 'profile' adds name/picture. 'email' adds email address. 'offline_access' requests refresh tokens for long-lived sessions. For API scopes, use resource-specific scopes (e.g. 'read:messages write:messages') rather than broad admin scopes. Users are more likely to consent to narrow, specific scopes.
How does the token exchange work?▼
After the user approves and the server redirects back with ?code=AUTH_CODE, your backend sends a POST request to the token endpoint with: grant_type=authorization_code, the code, redirect_uri (must match exactly), client_id, and code_verifier (for PKCE). The server verifies the verifier matches the challenge, then returns an access_token, optional refresh_token, and optional id_token. Never do the token exchange from client-side JavaScript — the code is only valid once.
What is the difference between access tokens and refresh tokens?▼
Access tokens are short-lived credentials (typically 15 minutes to 1 hour) that authorize API calls. Include them in the Authorization header: 'Bearer <token>'. Refresh tokens are long-lived (days to months) and are used only to obtain new access tokens when the current one expires. Refresh tokens must be stored securely (HttpOnly cookies or secure server storage) — if leaked, they allow prolonged unauthorized access. Rotate refresh tokens on each use.
Related Products
on GumroadDeveloper 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 →AI Prompt Engineering Toolkit
58 structured prompt templates for Claude, ChatGPT, and Gemini — organized by use case. Code Review, Debugging, Documentation, Architecture, and 10 model-specific tips. Stop writing prompts from scratch.
Buy on Gumroad →Developer Cheat Sheet Bundle
10 print-ready cheat sheets for the tools developers use every day: Git, Docker, Linux CLI, SQL, Regex, HTTP Status codes, VS Code shortcuts, Bash scripting, jq/JSON, and Markdown.
Buy on Gumroad →You Might Also Need
JWT Decoder
Free JWT decoder. Inspect any JSON Web Token
Open free tool →
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 →
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.
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.
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.
JWT Decoder: How to Read Token Payloads
Learn how to decode JWT tokens and read their payloads. A practical guide to JWT structure, claims, expiry checking, and debugging auth issues with a free online decoder.
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 →