I am getting Csrf token mismatch error on every post request I am making in the project. I am using ajax at some places and normal form submission at other places. However the error is constant.
I have tried several things as suggested on this site like
SESSION_SECURE_COOKIE=false
.@csrf
inside <form></form>
<meta name="csrf-token" content="{{ csrf_token() }}" />
and
$.ajaxSetup({headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content');}});
before ajax call.php artisan config:clear
php artisan route:clear
composer dump-autoload
.The error is same throughout. The application was working absolutely fine. What is the thing I am missing?
In your config/session.php file, try setting same_site
to lax
,null
.
After that run php artisan config:cache
.