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

Let's avatar
Level 4

TokenMismatchException in VerifyCsrfToken.php line 67, Laravel 5.2

Hello all,

I've finished my local Laravel development. Now I'm publishing it with DigitalOcean and Laravel Forge. The problem is I have the error

TokenMismatchException in VerifyCsrfToken.php line 67:
    in VerifyCsrfToken.php line 67
    at VerifyCsrfToken->handle(object(Request), object(Closure))
    at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
    at Pipeline->Illuminate\Pipeline{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
    at Pipeline->Illuminate\Routing{closure}(object(Request)) in ShareErrorsFromSession.php line 49
    at ShareErrorsFromSession->handle(object(Request), object(Closure))
    ...

My session driver is database.

My tries :

- DROP database mydatabase;

- CREATE database mydatabase;

- php artisan cache:clear

- php artisan views:clear

- php artisan key:generate

- php artisan migrate --force

-> Login page TokenMismatchException line 67 :(

Have I missed something? My local version doesn't have that problem. CSRF token are correctly included in requests (local or prod versions).

0 likes
4 replies
dream3r's avatar

Hello, I have the same problem. Did you solve the error?

Thank you in advance!

dream3r's avatar

Hello, after doing this, Laravel does not detect me the routes.

InvalidArgumentException in FileViewFinder.php line 137:
View [welcome] not found.

How can I solve it?

raiomido's avatar

It is most likely a permission issue. If developing on Linux this happens because, www-data is being denied permission to write to storage directory. To fix this, just run

cd /pathtorootdirectory
$ sudo chown -R www-data:www-data storage
1 like

Please or to participate in this conversation.