best-kangaroo-27443
02/12/2025, 9:12 PMmagnificent-energy-493
best-kangaroo-27443
02/12/2025, 10:29 PMbest-kangaroo-27443
02/12/2025, 10:31 PMdazzling-nightfall-42114
02/13/2025, 12:34 AMcookies:
domain: <http://example.com|example.com>
path: /
same_site: Lax
You also need to do everything on https otherwise the cookie won’t set.
For local development of our app I add <http://local.example.com|local.example.com> 127.0.0.1
to my /etc/hosts
and run caddy locally to reverse proxy <https://local.example.com>
to my app. Now I get to do local development using the remote kratos instance, and all the cookies get set correctly like it’s all remote.best-kangaroo-27443
02/13/2025, 12:35 AMdazzling-nightfall-42114
02/13/2025, 12:55 AM--dev
does not set Secure: true
, so you should be able to send those cookies over http. But if kratos is sending you the cookie and your browser is not using it, then it’s probably a browser security feature you’re running into. In the past I have found moving everything to https solves some of those (e.g. if you need SameSite: None
) but maybe it is not actually needed here.best-kangaroo-27443
02/13/2025, 12:58 AMdazzling-nightfall-42114
02/13/2025, 1:03 AMoryClient.updateLoginFlow()
in server components? If so, have you remembered to pass the cookie through nextjs (ie get it from the incoming request and add it to the api call)?best-kangaroo-27443
02/13/2025, 1:06 AMdazzling-nightfall-42114
02/13/2025, 1:08 AMaxiosInstance.interceptors.request.use(async config => {
const headers = await getHeaders();
config.headers.cookie = headers.get('cookie');
return config;
});
oryClient.updateRegistrationFlow()
will not automatically include the cookie if called on the server, you have to pass it.best-kangaroo-27443
02/13/2025, 1:14 AMbest-kangaroo-27443
02/13/2025, 1:15 AMdazzling-nightfall-42114
02/13/2025, 1:17 AMbest-kangaroo-27443
02/13/2025, 1:19 AMbest-kangaroo-27443
02/13/2025, 1:22 AM"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."
bit ambiguous to mebest-kangaroo-27443
02/13/2025, 1:26 AMdazzling-nightfall-42114
02/13/2025, 1:38 AMdazzling-nightfall-42114
02/13/2025, 1:42 AMbest-kangaroo-27443
02/13/2025, 1:43 AMbest-kangaroo-27443
02/13/2025, 1:46 AMbest-kangaroo-27443
02/13/2025, 1:48 AM