Skip to content

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.

  • 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.

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”
observe({what: "history"})
observe({what: "network_waterfall", status_min: 300, status_max: 399, limit: 30})

This shows the exact chain of redirects.

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.

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"})
  • 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 Idea] Redirect chain ladder diagram (/login -> /callback -> /login).

[Image Idea] Side-by-side cookie table: “broken state” vs “working state”.

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.