Fix "419 Sorry, your session has expired" After Renaming a Laravel Project


After renaming a Laravel Project, I always received “419 Sorry, your session has expired.” errors when submitting POST requests. The solution was pretty simple, all I had to do is to regenerate the application keys:

php artisan key:generate

It seems, there is a session encryption problem when renaming a Laravel app.

Hint: Be careful when running the command above. The key is used for encryption, so some of your encrypted data (like passwords) may be useless.