i have laravel application outputs token in field on every page. jquery loads token every ajax request, answered here: laravel 5 csrf global token hidden field forms in page
but every once in while, tokenmismatch exceptions on ajax calls.. happens when website idle long, , it's apparently random.
any ideas on how debug this? may causing this, or possible solutions?
if need ajax request, turn-off verifycsrftoken middleware on kernel.php file.
you can edit verifycsrftoken.php middleware file exclude urls way:
/** * uris should excluded csrf verification. * * @var array */ protected $except = [ 'ajax/*', 'api/*', ];
Comments
Post a Comment