From 5bfb667f689c84fcc9ccab3dbaae1132e2f162fc Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Mon, 15 Feb 2021 01:04:29 +0100 Subject: [PATCH] test --- .../dashboard/src/pages/api/accounts/authenticate.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/dashboard/src/pages/api/accounts/authenticate.js b/packages/dashboard/src/pages/api/accounts/authenticate.js index 9c75c4d1..d3412dbd 100644 --- a/packages/dashboard/src/pages/api/accounts/authenticate.js +++ b/packages/dashboard/src/pages/api/accounts/authenticate.js @@ -7,12 +7,16 @@ export default async (req, res) => { .post("http://oathkeeper:4455/login") .set("cookie", `ory_kratos_session=${req.cookies.ory_kratos_session}`); + console.log("auth.header", auth.header); res.setHeader("Set-Cookie", auth.header["set-cookie"]); - res.redirect(302, req.query.return_to ?? "/"); + res.redirect(req.query.return_to ?? "/"); } catch (error) { - res.redirect(302, "/auth/login"); // credentials were correct but accounts service failed + console.log("error", error); + + // res.redirect(302, "/auth/login"); // credentials were correct but accounts service failed + res.redirect("/"); // credentials were correct but accounts service failed } } else { - res.redirect(302, "/auth/login"); // redirect to login page if kratos session is missing + res.redirect("/auth/login"); // redirect to login page if kratos session is missing } };