test
This commit is contained in:
parent
3a223d0339
commit
b35ffb3ef8
|
@ -3,15 +3,15 @@ import superagent from "superagent";
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
if (req.cookies.ory_kratos_session) {
|
if (req.cookies.ory_kratos_session) {
|
||||||
try {
|
try {
|
||||||
const auth = await superagent.post("http://oathkeeper:4455/login");
|
const auth = await superagent
|
||||||
// .set("cookie", `ory_kratos_session=${req.cookies.ory_kratos_session}`);
|
.post("http://oathkeeper:4455/login")
|
||||||
|
.set("cookie", `ory_kratos_session=${req.cookies.ory_kratos_session}`);
|
||||||
|
|
||||||
res.setHeader("Set-Cookie", auth.header["set-cookie"]);
|
res.setHeader("Set-Cookie", auth.header["set-cookie"]);
|
||||||
|
res.redirect(302, req.query.return_to ?? "/");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
res.redirect(302, "/auth/login"); // credentials were correct but accounts service failed
|
res.redirect(302, "/auth/login"); // credentials were correct but accounts service failed
|
||||||
}
|
}
|
||||||
|
|
||||||
res.redirect(302, req.query.return_to ?? "/");
|
|
||||||
} else {
|
} else {
|
||||||
res.redirect(302, "/auth/login"); // redirect to login page if kratos session is missing
|
res.redirect(302, "/auth/login"); // redirect to login page if kratos session is missing
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue