Support the ongoing development of Laravel.io →
Configuration Security Session
Last updated 5 months ago.
0
Solution

I found a solution:

This answer is for all the people who have already used {{ csrf_field() }} after the <form> tag in their view.blade.php file and have also run the php artisan key:generate command but are still getting the Token Mismatch error. These are the steps I took to resolve the TokenMismatchException error for one of my projects that was still in development.

Delete cache files from the following two folders within your laravel project:

storage/framework/sessions/
storage/framework/views/

After removing the cache files, clear your browser cache.

And everyone who uses {{Auth::user()->somefield}} everyone must check the authentication site visitors, for example:

<script>     
var auth = 0;
@if({{Auth::check()}})
     var auth = '{{Auth::user()->name}}';
@endif
</script> 

And then problem will disappear.

It's mean that web-programmer shouldn't do something like:

<script>
   alert('{{Auth::user()->id}}');
</script>
//Just for example..
Last updated 6 years ago.
0

Sign in to participate in this thread!

LaraJobs

Your banner here too?

Anduil anduil Joined 21 Jul 2016

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 Laravel.io - All rights reserved.