TokenMismatchException in VerifyCsrfToken.php line 53 in Laravel 5.1

前端 未结 13 1239
独厮守ぢ
独厮守ぢ 2020-12-11 16:47

When I try to login show me token error. I have checked token in view form it\'s right and when comment \\App\\Http\\Middleware\\VerifyCsrfToken::class, in the

13条回答
  •  时光取名叫无心
    2020-12-11 17:16

    I had the same problem. I am using Laravel 5.1.28, php 5.6.13
    After seeing the TokenMismatchException in VerifyCsrfToken, I searched the web for answers but none solved my problem.

    The page did send the token. The token values is also seen in the session file in the directory storage/framework/sessions (I disabled encryption to see it).

    Exhausted, I re-install laravel and use simple form for testing - it worked without token mismatch error.

    Moving my code to the newly installed laravel piece by piece, I finally found that the problem was caused by doctrine/dbal (I still do not know why).

    Removed it from composer.json and the problem disappeared.
    In the composer.json, token mismatch error was seen with the following line:

    "require": {
        ....
        "doctrine/dbal": "^2.5"
        ...
    },
    

    Your case may be different, but you may want to see if you change anything in composer.json that may be causing the problem.

提交回复
热议问题