settings
This commit is contained in:
parent
9b80d15aa3
commit
0073234f26
|
@ -1,9 +1,9 @@
|
||||||
// import Link from "next/link";
|
// import Link from "next/link";
|
||||||
import { Configuration, AdminApi } from "@ory/kratos-client";
|
import { Configuration, PublicApi } from "@ory/kratos-client";
|
||||||
import config from "../config";
|
import config from "../config";
|
||||||
// import Message from "../components/Form/Message";
|
// import Message from "../components/Form/Message";
|
||||||
|
|
||||||
const kratos = new AdminApi(new Configuration({ basePath: config.kratos.public }));
|
const kratos = new PublicApi(new Configuration({ basePath: config.kratos.public }));
|
||||||
|
|
||||||
export async function getServerSideProps(context) {
|
export async function getServerSideProps(context) {
|
||||||
const flow = context.query.flow;
|
const flow = context.query.flow;
|
||||||
|
@ -23,12 +23,16 @@ export async function getServerSideProps(context) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// console.log("headers", context.req.headers);
|
// console.log("headers", context.req.headers);
|
||||||
// const { data: session } = await kratos.whoami(context.req.headers.cookie, context.req.headers.authorization);
|
const { data: session, headers } = await kratos.whoami(
|
||||||
// console.log(JSON.stringify(session));
|
context.req.headers.cookie,
|
||||||
|
context.req.headers.authorization
|
||||||
|
);
|
||||||
|
console.log("session", JSON.stringify(session));
|
||||||
|
console.log("headers", JSON.stringify(headers));
|
||||||
// return { flow: "NOT YET" };
|
// return { flow: "NOT YET" };
|
||||||
const { status, data } = await kratos.getSelfServiceSettingsFlow(flow);
|
// const { status, data } = await kratos.getSelfServiceSettingsFlow(flow);
|
||||||
|
|
||||||
if (status === 200) return { props: { flow: data } };
|
// if (status === 200) return { props: { flow: data } };
|
||||||
|
|
||||||
throw new Error(`Failed to retrieve flow ${flow} with code ${status}`);
|
throw new Error(`Failed to retrieve flow ${flow} with code ${status}`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
Reference in New Issue