Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions src/client/AuthKitProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,18 @@ export function AuthKitProvider({ children, onSessionExpired }: AuthKitProviderP
if (error instanceof Response) {
const location = error.headers.get('Location');
if (location) {
// Check if external URL (WorkOS logout) or internal route
const isExternal = location.startsWith('http') && !location.includes(window.location.host);
if (isExternal) {
// External OAuth/logout URL requires full page navigation
window.location.href = location;
} else {
// Internal routes use TanStack Router navigation
try {
const url = new URL(location, window.location.origin);
if (url.origin === window.location.origin) {
// Internal routes use TanStack Router navigation with path only
const path = url.pathname + url.search + url.hash;
navigate({ to: path });
} else {
// External OAuth/logout URL requires full page navigation
window.location.href = location;
}
} catch {
// Invalid URL - use TanStack Router navigation as-is (for relative paths)
navigate({ to: location });
}
return;
Expand Down