return to test

This commit is contained in:
Karol Wypchlo 2021-02-11 22:34:37 +01:00
parent 551debf703
commit a35a020871
1 changed files with 18 additions and 2 deletions

View File

@ -1,6 +1,22 @@
import superagent from "superagent";
import { serialize } from "cookie"; import { serialize } from "cookie";
export default (req, res) => { export default async (req, res) => {
res.setHeader("Set-Cookie", serialize("foo", Math.random(), {})); console.log(Object.keys(req));
console.log(req.url);
console.log(req.cookies);
console.log(req.rawHeaders);
try {
const auth = await superagent
.set("Cookie", serialize("ory_kratos_session", req.cookies.ory_kratos_session))
.get("/user");
console.log(auth.header);
res.setHeader("Set-Cookie", auth.header["set-cookie"]);
} catch (error) {
console.log(error);
}
res.redirect(302, req.query.return_to); res.redirect(302, req.query.return_to);
}; };