I develop multi auth laravel 5.7 application and i works fine in my local env but after deploying it to shared host server and try to login or activate any post request with CSRF token the server return 419 session expire please refresh the page. if i disallow laravel csrf middle-ware it works fine, right now i'm really confused and need any help about this situation or the any information about why laravel will return this error
-
Did you check your session configuration?– jakub_joOct 10, 2018 at 9:51
-
can you explain more..– Ahmed MohamedOct 10, 2018 at 9:52
-
Apparently your sessions do not persist, you need to review your session configuration. Do you store the sessions in files? Is the directory writeable?– jakub_joOct 10, 2018 at 9:54
2 Answers
You have to define application key (APP_KEY
) before to use laravel application. so run below command for creating new application key
php artisan key:generate
This will generate a key and put it in your env file.
After that delete your config cache and try again
php artisan config:cache
you're missing the APP_KEY=
in the .env file
-
i use the same env file from my local environment with the app key and change the database configs but still get the same response. Oct 10, 2018 at 9:50
-
have you checked your
SESSION_DRIVER=
in the .env file ? is there no error instorage/logs/laravel.log
file– N69SOct 10, 2018 at 9:52