Fix Login Redirect Loops and Session Bugs Without Guesswork
If your app keeps bouncing users between “Sign in” and “Dashboard,” you likely have a session bug.
A session is how your app remembers that a user is logged in. Sessions are often backed by cookies (small browser data tokens). Cookie basics: https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies
Here is a beginner-safe way to debug this with Gasoline Agentic Devtools.
Quick Terms
Section titled “Quick Terms”- Session: Login memory for a user.
- Cookie: Browser storage used for auth state.
- Application Programming Interface (API): Structured way browser and server exchange data. https://developer.mozilla.org/en-US/docs/Glossary/API
- Redirect loop: Page A sends to B, B sends back to A forever.
The Problem You Are Solving
Section titled “The Problem You Are Solving”You want to answer:
“Why does login not stick after successful sign-in?”
Step-by-Step with Gasoline Agentic Devtools
Section titled “Step-by-Step with Gasoline Agentic Devtools”Step 1. Record the redirect path
Section titled “Step 1. Record the redirect path”observe({what: "history"})observe({what: "network_waterfall", status_min: 300, status_max: 399, limit: 30})This shows the exact chain of redirects.
Step 2. Inspect cookie/session storage
Section titled “Step 2. Inspect cookie/session storage”observe({what: "storage", storage_type: "cookies"})observe({what: "storage", storage_type: "local"})observe({what: "storage", storage_type: "session"})Check whether auth data exists and survives navigation.
Step 3. Verify login API response
Section titled “Step 3. Verify login API response”observe({what: "network_bodies", url: "/auth", limit: 20})Confirm response status and expected fields.
Step 4. Replay and compare before/after fixes
Section titled “Step 4. Replay and compare before/after fixes”configure({what: "recording_start"})configure({what: "recording_stop", recording_id: "rec-login"})configure({what: "playback", recording_id: "rec-login"})configure({what: "log_diff", original_id: "rec-before", replay_id: "rec-after"})Common Root Causes
Section titled “Common Root Causes”- Cookie set on wrong domain/path.
- Auth token saved in one store but read from another.
- Frontend route guard runs before session state is ready.
- Backend returns success but no usable token.
Image and Diagram Callouts
Section titled “Image and Diagram Callouts”[Image Idea] Redirect chain ladder diagram (
/login->/callback->/login).
[Image Idea] Side-by-side cookie table: “broken state” vs “working state”.
You’re Doing Advanced Debugging Now
Section titled “You’re Doing Advanced Debugging Now”Session bugs feel random. They are not random. With Gasoline Agentic Devtools, you can see the chain, storage state, and network truth in one place.