Framework: CSRF token mismatch error

Created on 9 Apr 2017  路  1Comment  路  Source: laravel/framework

  • Laravel Version:
    Laravel Framework 5.4.17
  • PHP Version:
    PHP 7.1.3-3+deb.sury.org~yakkety+1 (cli) (built: Mar 25 2017 14:01:32) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies with Zend OPcache v7.1.3-3+deb.sury.org~yakkety+1, Copyright (c) 1999-2017, by Zend Technologies
  • Database Driver & Version:
    mysql Ver 14.14 Distrib 5.7.17, for Linux (x86_64) using EditLine wrapper

Description:

My logs are filling up constantly with:
Illuminate\Session\TokenMismatchException in /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php:68

Steps To Reproduce:

Additional Notes:

From Session.php
'encrypt' => true,
'http_only' => true,

From .env
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
SESSION_SECURE_COOKIE=true
QUEUE_DRIVER=sync

My site is running latest NGINX and is using HTTPS with SSL Cert from lets encrypt. I followed this guide.
https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04

So my site is only accessible from HTTPS. In my browser I can see the cookies are being sent to me.
Imgur

Im at a loss of why this is happening.

Most helpful comment

This is not related to your SSL.

Are you including the csrf_token() in your forms? You need to read the guide here: https://laravel.com/docs/5.4/csrf

Regardless this is a question to be asked on the forums - please ask there (and close the issue here). https://laracasts.com/discuss

>All comments

This is not related to your SSL.

Are you including the csrf_token() in your forms? You need to read the guide here: https://laravel.com/docs/5.4/csrf

Regardless this is a question to be asked on the forums - please ask there (and close the issue here). https://laracasts.com/discuss

Was this page helpful?
0 / 5 - 0 ratings