Skip to content

Redirect to login when token refresh fails on 401#3248

Draft
rossnelson wants to merge 13 commits intomainfrom
fix-session-expiry-redirect
Draft

Redirect to login when token refresh fails on 401#3248
rossnelson wants to merge 13 commits intomainfrom
fix-session-expiry-redirect

Conversation

@rossnelson
Copy link
Collaborator

Summary

  • Adds redirect to login page in ossPostResponse when a 401 response can't be recovered via token refresh
  • Fixes a gap where background requests (e.g. workflow counts) that bypass handleError would silently fail on session expiry instead of redirecting to login
  • Uses BROWSER guard to keep the redirect SSR-safe

Tests

  • Unit tests for the redirect behavior in oss-provider.test.ts (redirect fires on failed refresh, not on non-401)
  • Integration test in request-from-api.integration.test.ts with window.location properly stubbed
  • Playwright e2e test in oauth-flow.spec.ts covering the full session-expiry → redirect flow

Notes

Depends on / intended to merge after #FixAuthWeirdNessCookieVersion.

GiantRobots and others added 12 commits March 13, 2026 12:46
…Re-wire with-access-token to use pre/post hooks so code paths can be determined by the caller. Lots of tests
When ossPostResponse receives a 401 and refreshTokens returns false,
redirect the browser to the login page so expired sessions don't silently
fail — particularly for background requests that bypass handleError.

Add unit tests for the redirect behavior and a Playwright integration
test covering the full session-expiry redirect flow.
@vercel
Copy link

vercel bot commented Mar 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
holocene Ready Ready Preview, Comment Mar 24, 2026 8:09pm

Request Review

split('=')[1] drops any '=' padding characters in the base64-encoded
cookie value. Switch to indexOf('=') to correctly preserve them.

Add tests covering both the happy path and a value with '=' padding.
Base automatically changed from FixAuthWeirdNessCookieVersion to main March 25, 2026 00:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants