From 9ce44fd2258fd6e6c275e8b56711e9ed335996d6 Mon Sep 17 00:00:00 2001 From: Maina Wycliffe Date: Mon, 25 Sep 2023 13:12:28 +0300 Subject: [PATCH] fix: fix double login for kratos login Closes #1408 chore: remove refresh --- .../Authentication/Kratos/KratosAuthSessionChecker.tsx | 8 -------- src/components/Authentication/Kratos/KratosLogin.tsx | 3 ++- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/components/Authentication/Kratos/KratosAuthSessionChecker.tsx b/src/components/Authentication/Kratos/KratosAuthSessionChecker.tsx index d3801598f..ac462cbd0 100644 --- a/src/components/Authentication/Kratos/KratosAuthSessionChecker.tsx +++ b/src/components/Authentication/Kratos/KratosAuthSessionChecker.tsx @@ -29,21 +29,13 @@ export default function KratosAuthSessionChecker({ const url = window.location.pathname; switch ((err as AxiosError).response?.status) { case 403: - // This is a legacy error code thrown. See code 422 for - // more details. push(`/login?aal=aal2&return_to=${url}`); - return; break; case 422: - // This status code is returned when we are trying to - // validate a session which has not yet completed - // it's second factor push(`/login?aal=aal2&return_to=${url}`); - return; break; case 401: push(`/login?return_to=${url}`); - return; break; default: throw err; diff --git a/src/components/Authentication/Kratos/KratosLogin.tsx b/src/components/Authentication/Kratos/KratosLogin.tsx index defeba302..bc6ab08cc 100644 --- a/src/components/Authentication/Kratos/KratosLogin.tsx +++ b/src/components/Authentication/Kratos/KratosLogin.tsx @@ -68,11 +68,12 @@ const Login: NextPage = () => { updateLoginFlowBody: values }); if (flow?.return_to) { - await router.push(flow?.return_to); + window.location.href = flow?.return_to; } else { await router.push("/"); } } catch (err: any) { + console.error(err); await handleFlowError(router, "login", setFlow)(err); if (err.response?.status === 400) { setFlow((err.response as any).data);