Skip to content

Commit

Permalink
fix: fix double login for kratos login
Browse files Browse the repository at this point in the history
Closes #1408

chore: remove refresh
  • Loading branch information
mainawycliffe committed Sep 25, 2023
1 parent 4c79f75 commit 9ce44fd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/components/Authentication/Kratos/KratosLogin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 9ce44fd

Please sign in to comment.