Laravel 5.4 TokenMismatchException in VerifyCsrfToken.php line 68 on some device
I know it's one of the most asked question around here, but I really read everything on the first 10 pages results on google and nothing solved my problem.
On a fresh installation of laravel 5.4 , generated the auth controller, views, etc. via php artisan make:auth when I try to register (or login) in some device I get the following error:
TokenMismatchException in VerifyCsrfToken.php line 68
I'm running this application in local on debian 8.7 and php7 (could it be related to the problem in some way ?) From my pc, iphone 7, another windows 10 desktop it works perfectly, but on a Huawei p8 lite, ipad 2 and lubuntu (quite old version) I get that error. So it's really weird because it just happends with some device (no matter whaht O.S. no matter what browser).
And also if I run a project that I created on another pc where it works, it gives me the same TokenMismatchException problem (on my pc too). The weird thing is that if I move all those projects somewhere else (like another pc or on a remote server) they work perfectly! So I come to conclusion that there must be something wrong with my configuration in some way, but I tried to reinstall composer and laravel too with no luck.
I can already tell you that I tried grant permissions to sessions folder, change session_domain, clearing cache (but as I said I'm trying this on a fresh installation), change {{ csrf_token }} to {!! csrf_token !!} , etc.
Just to give you more information about my system, this is the php version i'm using:
php --version PHP 7.0.17-1~dotdeb+8.1 (cli) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies with Zend OPcache v7.0.17-1~dotdeb+8.1, Copyright (c) 1999-2017, by Zend Technologies
I'm really stuck on this for a month now. Got no more ideas.
Thank you for your interest and sorry for the late.
Actually I found out that a fresh installation, after clearing the cache of the browsers on all the devices, was working fine. So I set up a SESSION_DOMAIN= in the .env file (it was null into the session.php file). But I didn't use localhost (because it wasn't working either), I inserted a custom domain (previously added in /etc/hosts) and it started working again.
I don't know what exactly happened and why, but it seems to work in this way.
p.s.
@laurence you were on the right way. thanks!
Please or to participate in this conversation.