feat: implement path prefix handling for OAuth and login redirects

This commit is contained in:
Linus Rath
2026-03-24 14:44:42 +01:00
parent de26e6da2e
commit 13010c158d
5 changed files with 64 additions and 13 deletions
@@ -2,6 +2,7 @@
import { useEffect } from "react";
import { isEmbedded, listenFromParent } from "@/lib/iframe-bridge";
import { getPathPrefix, getLocaleFromPath } from "@/lib/browser-navigation";
import { useAuthStore } from "@/stores/auth-store";
import { useConfig } from "@/hooks/use-config";
@@ -16,9 +17,9 @@ export function EmbeddedBridgeProvider({ children }: { children: React.ReactNode
switch (msg.type) {
case "sso:trigger-login": {
// Navigate to login page to start SSO flow
const segments = window.location.pathname.split("/").filter(Boolean);
const locale = segments[0] || "en";
window.location.href = `/${locale}/login`;
const prefix = getPathPrefix();
const locale = getLocaleFromPath();
window.location.href = `${prefix}/${locale}/login`;
break;
}
case "sso:trigger-logout":