clean up
This commit is contained in:
parent
9a4c400252
commit
cf765cd8e1
|
@ -17,7 +17,7 @@ export default function Layout({ title, children }) {
|
|||
|
||||
window.location = `${config.kratos.browser}/self-service/browser/flows/logout`;
|
||||
} catch (error) {
|
||||
console.log(error); // todo: handle errors
|
||||
console.log(error); // todo: handle errors with a message
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
|
||||
|
||||
import jwt from "express-jwt";
|
||||
import jwks from "jwks-rsa";
|
||||
import config from "../../config";
|
||||
|
||||
// This middleware assumes that the app is secured using ORY Oathkeeper, in which case we
|
||||
// verify the JSON Web Token issued by ORY Oathkeeper using the jwt-express middleware.
|
||||
|
||||
const middleware = jwt({
|
||||
// Dynamically provide a signing key based on the kid in the header and the signing keys provided by the JWKS endpoint.
|
||||
secret: jwks.expressJwtSecret({
|
||||
cache: true,
|
||||
jwksRequestsPerMinute: 5,
|
||||
jwksUri: config.jwksUrl,
|
||||
}),
|
||||
algorithms: ["RS256"],
|
||||
});
|
||||
|
||||
// Helper method to wait for a middleware to execute before continuing
|
||||
// And to throw an error when an error happens in a middleware
|
||||
function runMiddleware(req, res, fn) {
|
||||
return new Promise((resolve, reject) => {
|
||||
fn(req, res, (result) => {
|
||||
if (result instanceof Error) {
|
||||
return reject(result);
|
||||
}
|
||||
|
||||
return resolve(result);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export default async (req, res) => {
|
||||
await runMiddleware(req, res, middleware);
|
||||
|
||||
console.log(Object.keys(req));
|
||||
console.log(req.user);
|
||||
res.statusCode = 200;
|
||||
res.json({ name: "John Doe" });
|
||||
};
|
|
@ -1,7 +0,0 @@
|
|||
export default (req, res) => {
|
||||
console.log("method", req.method);
|
||||
console.log("body", req.body);
|
||||
console.log("cookies", req.cookies);
|
||||
|
||||
res.status(200).json({ name: "John Doe", extra: { foo: "bar" }, header: { foo: ["bar1", "bar2"] } });
|
||||
};
|
|
@ -70,8 +70,6 @@ export default function Login({ flow }) {
|
|||
initialValues: fields.reduce((acc, field) => ({ ...acc, [field.name]: field.value }), {}),
|
||||
});
|
||||
|
||||
console.log(flow);
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-gray-50 flex flex-col justify-center py-12 sm:px-6 lg:px-8">
|
||||
<div className="sm:mx-auto sm:w-full sm:max-w-md">
|
||||
|
|
|
@ -24,10 +24,6 @@ export async function getServerSideProps(context) {
|
|||
try {
|
||||
const { status, data } = await kratos.getSelfServiceRecoveryFlow(flow);
|
||||
|
||||
console.log("================================================================");
|
||||
console.log(flow);
|
||||
console.log("================================================================");
|
||||
|
||||
if (status === 200) return { props: { flow: data } };
|
||||
|
||||
throw new Error(`Failed to retrieve flow ${flow} with code ${status}`);
|
||||
|
|
Reference in New Issue