loud-analyst-7260
06/16/2023, 10:09 PM<http://localhost:3001/login>
. When attempting to login, I’m redirected to my Ory Network project, then redirected to <http://localhost:3001/login>
however, I get an error when the Nextjs app calls getLoginFlow
which hits <http://localhost:4000>
ory tunnel. I’m running the tunnel with ory tunnel <http://localhost:3001> --dev
(having set the ORY_SDK_URL
environment variable). The error I’m getting calling <http://localhost:4000/self-service/login/flows?id=>…
is
{
"error": {
"id": "security_csrf_violation",
"code": 403,
"status": "Forbidden",
"request": "c044fb7d-7656-9e86-8cb5-a65e0c8c4747",
"reason": "Please retry the flow and optionally clear your cookies. The request was rejected to protect you from Cross-Site-Request-Forgery (CSRF) which could cause account takeover, leaking personal information, and other serious security issues.",
"details": {
"docs": "<https://www.ory.sh/kratos/docs/debug/csrf>",
"hint": "The anti-CSRF cookie was found but the CSRF token was not included in the HTTP request body (csrf_token) nor in the HTTP Header (X-CSRF-Token).",
"reject_reason": "The HTTP Cookie Header was set and a CSRF token was sent but they do not match. We recommend deleting all cookies for this domain and retrying the flow."
},
"message": "the request was rejected to protect you from Cross-Site-Request-Forgery"
}
}
Any idea what could be going wrong?high-optician-2097
high-optician-2097
loud-analyst-7260
06/21/2023, 4:35 PMlogin.tsx
page:
export async function getServerSideProps({ req, query }: NextPageContext) {
const cookie = req?.headers.cookie;
const id = query.flow as string;
const flowData = cookie && id
? await ory
.getLoginFlow({ id, cookie })
.then(({ data: flow }) => {
return flow;
})
.catch((err) => {
console.log("err", err);
return null;
})
: null;
return {
props: {
flowData,
},
};
}
high-optician-2097
loud-analyst-7260
06/29/2023, 8:15 PMnextjs-spa
in the ory/elements
repo to send the request from the backend as shown above