return to test
This commit is contained in:
parent
551debf703
commit
a35a020871
|
@ -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);
|
||||||
};
|
};
|
||||||
|
|
Reference in New Issue