Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Inquisitive's avatar

CSRF Token Mismatch with Breeze API

What I have done:

  1. called API /sanctum/csrf-cookie

  2. copied X-CSRF-TOKEN value from the response cookie https://ibb.co/N64RrDt

  3. Tried to send X-CSRF-TOKEN as header. https://ibb.co/HnDRmDK

But still receiving csrf token mismatch

#PS: I am not looking to bypass CSRF token requirement by adding the register URL on VerifyCsrfToken

0 likes
7 replies
RayC's avatar

You have an error in the token name X-CSRF-TOKEN should be X-XSRF-TOKEN.

Also looks like you're using Postman. I have not had to send the token via Postman as it appears to do it automatically for me.

maseed's avatar

@Inquisitive Is your problem solved now? I am also facing the same problem. Let me know. Thanks

pushkarbisht's avatar

I know this is an old thread, but some people still face this issue. I was also facing this issue and struggled to find a solution on the internet. I finally was able to solve this by first URL Decoding the "XSRF-TOKEN" before using it on headers. It's good to delete cookies before sending the request.

Please or to participate in this conversation.