CSRF token requested per post does not match Laravel 9
<p>I receive a Csrf token mismatch error for <strong>every post request</strong> I make in my project. I'm using ajax in some places and normal form submission in others. However the error is constant. </p>
<p>I have tried a few things as suggested on this site, such as </p>
<ol>
<li>Set<code>SESSION_SECURE_COOKIE=false</code>. </li>
<li>Add <code>@csrf</code></code></li> inside <code><form></form>
<li>Add <code><meta name="csrf-token" content="{{ csrf_token() }}" /></code> and
<code>$.ajaxSetup({headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content');}});</ code>Before the ajax call. </li>
<li>Run<code>php artisan config:clear</code> <code>php artisan route:clear</code> <code>composer dump-autoload</code>. </li>
<li>Run the project on different browsers. </li>
</ol>
<p>The error is the same throughout. The app works very well.
What am I missing? </p>