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

engsyam's avatar
Level 17

csrf not working on server

when i upload my project to the serve get this :: TokenMismatchException in VerifyCsrfToken.php line 67: but at localhost it's working

note :: i use {{ csrf_field() }}

v5.2

0 likes
5 replies
christiangerdes's avatar

I had the same problem and I fixed it by setting a domain in the session.php. Don't know why??

christiangerdes's avatar

In your session.php file change the domain setting.

In my case I have null on local but the domain name on production

jimmy0699's avatar

check if you csrf_token is sent inside <form> attribute check if your routes are inside web middleware check if your .env file is correct

Please or to participate in this conversation.