Fix expired session showing EmbeddedFallback in portal iframe

When the JWT expired, AuthGate redirected window.location to /auth/login
which loaded inside the portal iframe. The portal detected window.self !==
window.top and showed the EmbeddedFallback ("This app isn't available yet")
instead of the login page.

Redirect window.top instead so the portal itself navigates to /login.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
jtricerolph 2026-07-09 20:19:36 +00:00
parent 76ed477c3a
commit f3e02c3867

View file

@ -28,7 +28,9 @@ export default function AuthGate({ children }: { children: ReactNode }) {
caps: data.caps ?? [],
}))
.catch(() => {
window.location.href = '/auth/login?redirect=' + encodeURIComponent(window.location.pathname)
// Redirect the top-level window, not the iframe, so the portal
// navigates to login rather than loading inside itself (EmbeddedFallback).
;(window.top ?? window).location.href = '/login'
})
.finally(() => setChecking(false))
}, [])