diff --git a/frontend/src/Router.tsx b/frontend/src/Router.tsx
index 844870ac3..fc8044e41 100644
--- a/frontend/src/Router.tsx
+++ b/frontend/src/Router.tsx
@@ -1,4 +1,4 @@
-import React from "react";
+import React, {useEffect} from "react";
import {Navigate, Route, Routes} from "react-router-dom";
import App from "./app/App";
import {selectIsAuthenticated} from "./app/authSlice";
@@ -36,6 +36,13 @@ export default function Router() {
return isAuthenticated ? element : ;
};
+ function WindowClose() {
+ useEffect(() => {
+ window.close();
+ }, []);
+ return null;
+ }
+
return (
> : }
/>
+ }
+ />
}
diff --git a/frontend/src/common/services/apis.ts b/frontend/src/common/services/apis.ts
index 580c43c09..bdc25afaf 100644
--- a/frontend/src/common/services/apis.ts
+++ b/frontend/src/common/services/apis.ts
@@ -69,7 +69,11 @@ const baseQueryWithReAuth: BaseQueryFn {
+ // Open login in a new window/tab to avoid losing form data
+ const callBackUrl = new URL("/window-close", window.location.origin).toString();
+ window.open(getSignInUrl(callBackUrl), "_blank");
+ }, 1000);
}
}
return result;