Getting CSRF token mismatch on all post calls #229
Replies: 8 comments 4 replies
-
Comment out \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class on Kernel.php file, if you are using scantum. |
Beta Was this translation helpful? Give feedback.
-
this is just a 'hack' |
Beta Was this translation helpful? Give feedback.
-
I hope to use it for a legacy project (Laravel 9) with |
Beta Was this translation helpful? Give feedback.
-
I've already done a pull request #336 to fix this problem. You can check how I've solved this problem. |
Beta Was this translation helpful? Give feedback.
-
It is not in a release yet: Do this to fetch the latest as of the time I write this: composer require "dedoc/scramble:dev-main#d1d8e26dee3e9e408351b856c645d0af3bd454af" -W |
Beta Was this translation helpful? Give feedback.
-
spent 2 days figuring this out and the solution that worked for me was adding the following in the env file. SANCTUM_STATEFUL_DOMAINS=localhost |
Beta Was this translation helpful? Give feedback.
-
I'm running into this problem as well. In my case it's specifically with Try It on routes that need Bearer tokens and the fact I have I would like to keep stateful APIs because our front end does call the JSON APIs currently. But I'm currently disabling Try It on the documentation pages. Is there a way to host the docs on a subdomain so Sanctum doesn't try to use CSRF checks? Alternatively, is there a way to disable CSRF checks not on an API route, but based on requests coming from the |
Beta Was this translation helpful? Give feedback.
-
Hi, It works for me now. My setup is also Stateful API using Sanctum. I have updated to Scramble v0.11.31. Thank you very much for support this case 🙏 |
Beta Was this translation helpful? Give feedback.
-
I am getting "CSRF token mismatch" on all POST calls make via the documentation page
Beta Was this translation helpful? Give feedback.
All reactions