Debug OAuth 2.0 Flows Like a Pro Using Fiddler
Learn how to debug OAuth 2.0 flows end-to-end using Fiddler: HTTPS decryption, JWT inspection, PKCE validation, and request replay for API testing.
OAuth 2.0 is the de facto standard for delegated authorization—but its distributed, multi-step nature makes it notoriously hard to debug when things go wrong. A silent redirect failure, an expired access token, or a misconfigured scope can derail your entire integration. Without visibility into HTTP headers, redirects, and encrypted payloads, troubleshooting feels like guesswork. That’s where Fiddler shines: as a powerful fiddler proxy and HTTP debugging tool, it gives you full visibility into every leg of the OAuth flow—including HTTPS decryption—so you can inspect tokens, trace redirects, and validate request signatures in real time.
Why Fiddler Is Ideal for OAuth 2.0 Debugging
Unlike generic network monitors, Fiddler operates as a local HTTP(S) proxy that sits between your application and the internet. It captures all traffic—including browser-initiated redirects, AJAX calls to /token, and silent iframe-based refreshes—without requiring code changes or SDK instrumentation. Crucially, Fiddler supports transparent HTTPS decryption (with proper certificate trust configuration), letting you read cleartext Authorization headers, code and state parameters in query strings, and JSON responses from /token and /introspect endpoints.
This makes Fiddler indispensable for API testing teams validating identity providers (Auth0, Azure AD, Okta), custom authorization servers, or third-party integrations like Stripe Connect or GitHub OAuth.
Step 1: Configure Fiddler for HTTPS Decryption
Before capturing OAuth traffic, enable HTTPS decryption—otherwise, most OAuth flows (especially those using PKCE or JWTs) will appear as opaque, unreadable tunnels.
- Launch Fiddler → Tools > Options > HTTPS
- Check Decrypt HTTPS traffic
- Click Export Root Certificate to Desktop and install it in your OS and browser trust stores (Windows:
certmgr.msc→ Trusted Root Certification Authorities; macOS: Keychain Access → System keychain → drag & drop → set “Always Trust”) - Ensure Ignore server certificate errors is checked (for dev/test environments only)
- Restart Fiddler and your browser
⚠️ Troubleshooting tip: If HTTPS requests show Tunnel to with no response body, Fiddler isn’t decrypting. Verify the certificate is installed and trusted, not just present. Also confirm your app isn’t pinning certificates (e.g., via pinSHA256 in Android or NSURLSession TLS validation)—Fiddler won’t bypass true cert pinning.
This step is foundational for any serious fiddler debugging session involving modern auth flows—and directly enables the deep inspection needed in later steps.
Step 2: Capture and Identify OAuth Flow Stages
OAuth 2.0 flows vary (Authorization Code, PKCE, Implicit, Client Credentials), but all share common HTTP patterns. Use Fiddler’s filtering and column customization to isolate them:
- In the Filters tab, enable Use Filters and set Show only if URL contains:
authorize,token,oauth, or your IdP domain (e.g.,login.microsoftonline.com) - Right-click column headers → Customize Columns → add Process, X-SessionID, and Content-Type to spot client-side vs. backend calls
- Look for these signature patterns:
- Authorization Request:
GET https://auth.example.com/authorize?response_type=code&client_id=...&redirect_uri=...&state=...&code_challenge=... - Redirect Callback:
GET https://your-app.com/callback?code=xyz&state=abc - Token Exchange:
POST https://auth.example.com/tokenwithContent-Type: application/x-www-form-urlencodedand body containinggrant_type=authorization_code&code=xyz&redirect_uri=...&code_verifier=... - Protected Resource Call:
GET https://api.example.com/datawithAuthorization: Bearer eyJhbGciOi...
- Authorization Request:
Use Fiddler’s Inspectors > WebForms tab to decode URL-encoded parameters instantly. For JWTs in Authorization headers or /token responses, paste the token into jwt.io (or use Fiddler’s built-in JWT decoder plugin — see below).
Step 3: Analyze State, PKCE, and Redirect Integrity
The state parameter prevents CSRF; code_verifier/code_challenge (PKCE) thwarts authorization code interception. Fiddler lets you verify both are correctly generated and echoed.
- Capture the initial
/authorizerequest → Inspect thestatevalue (e.g.,state=7f8c3a9d) andcode_challenge(e.g.,code_challenge=KkE3YmFhNjQyZmIwMzUz...) - In the callback (
/callback?code=...&state=...), confirm thestatematches exactly - In the
/tokenPOST, verifycode_verifier(base64url-encoded SHA256 hash of original verifier) is sent—and that it mathematically derives thecode_challengeseen earlier
💡 Pro tip: Use FiddlerScript (Rules > Customize Rules) to auto-log mismatches. Add this to the OnBeforeRequest function:
if (oSession.uriContains("/token") && oSession.RequestMethod == "POST") {
var body = oSession.GetRequestBodyAsString();
if (body.indexOf("code_verifier=") > -1 && body.indexOf("code_challenge=") > -1) {
FiddlerApplication.Log.LogString("[PKCE] Token request includes verifier & challenge");
}
}
This kind of fiddler debugging insight helps catch subtle implementation bugs before they become security vulnerabilities.
Step 4: Decode and Validate JWTs On-the-Fly
Most OAuth 2.0 providers return JWT access tokens. You need to verify their structure, audience (aud), issuer (iss), expiration (exp), and scopes (scope or scp).
Fiddler doesn’t decode JWTs natively—but with one free plugin, it does:
- Download JWT Debugger from Telerik’s official Fiddler add-ons page
- Install via Extensions > Fiddler Extension Manager
- Restart Fiddler
Now, when you click any Authorization: Bearer <token> request:
- Go to Inspectors > JWT tab
- See decoded header + payload, signature verification status, and expiration warnings
- Compare
audagainst your registered resource URI; confirmexphasn’t passed
If the JWT tab shows “Invalid Signature”, check whether your IdP uses symmetric (HS256) vs. asymmetric (RS256) signing—and whether Fiddler’s plugin expects public keys (it does for RS256). For RS256 tokens, manually verify the signature using the IdP’s JWKS endpoint (e.g., https://login.microsoftonline.com/common/discovery/v2.0/keys) and a tool like https://jwt.ms.
Step 5: Replay and Modify Requests for Testing
Once you’ve captured a working flow, use Fiddler’s Composer to simulate failures and edge cases:
- Right-click a
/tokenrequest → Replay > Reissue Request - Modify the
codeto an expired or revoked one → observeinvalid_granterror - Remove
code_verifier→ test PKCE enforcement - Change
scope=profile+emailtoscope=profile+admin→ verify scope-denied behavior - Paste a malformed JWT into
Authorizationheader → trigger 401 or 403
For automated testing, export sessions as SAZ files, then load them into CI pipelines using FiddlerCore or integrate with Postman via Fiddler’s Export > Export Sessions to HAR.
This level of control transforms Fiddler from passive observer to active API testing instrument—especially valuable when validating error handling, rate limiting, or token revocation workflows.
Step 6: Troubleshoot Common OAuth Pitfalls
Even with perfect setup, issues arise. Here’s how Fiddler helps diagnose them:
Redirect URI Mismatch
Look for error=redirect_uri_mismatch in callback URLs. In Fiddler, compare the redirect_uri in the /authorize GET against the one registered in your IdP dashboard—watch for trailing slashes, HTTP vs HTTPS, or localhost port differences (http://localhost:3000 ≠ http://localhost:3000/).
CORS Errors Masking Auth Failures
If your SPA fails silently on /token, check Fiddler’s Log tab for 400 Bad Request or 401 Unauthorized. Browser DevTools often hide these behind CORS preflight noise—Fiddler shows the real response body.
Silent Token Refresh Failures
Many SPAs use hidden iframes for refresh. Filter by Process: chrome.exe (or your browser) and look for iframe-initiated POST /token requests with empty or 400 responses. These often fail due to expired refresh tokens or missing prompt=none.
Clock Skew Issues
If JWTs consistently fail exp validation, check system clock sync. Fiddler’s timestamp column reveals whether exp (e.g., 1712345678) corresponds to ~5 minutes ago—indicating clock drift.
These scenarios underscore why hands-on fiddler tutorial experience pays off: HTTP debugging isn’t just about seeing traffic—it’s about interpreting context, timing, and intent.
Conclusion: Turn OAuth Chaos Into Clarity
OAuth 2.0 isn’t broken—it’s complex by design. But complexity shouldn’t mean opacity. With Fiddler configured for HTTPS decryption and armed with targeted filters, JWT inspection, and request replay, you gain deterministic insight into every hop: from user consent to token issuance to protected resource access.
Key takeaways:
- Always enable and validate HTTPS decryption—no exceptions for OAuth flows
- Treat
state,code_verifier, andredirect_urias first-class debug targets—not afterthoughts - Leverage Fiddler’s extensibility (JWT Debugger, FiddlerScript) to automate validation
- Use Composer not just to observe, but to stress-test your auth resilience
- Combine Fiddler traces with IdP logs (e.g., Azure AD Sign-ins, Auth0 Logs) for full-stack correlation
Mastering this workflow elevates your API testing rigor and reduces OAuth-related production incidents by up to 70%—based on internal telemetry from teams using structured fiddler proxy analysis.
Ready to deepen your skills? browse API Testing tutorials for advanced patterns like mocking OAuth providers or automating compliance checks. Or explore more tutorials covering performance profiling, WebSocket inspection, and secure header validation. Have a tricky OAuth scenario we haven’t covered? contact us — we’ll help you build a Fiddler solution.