Laravel Token Mismatch Error in AJAX Check session storage path & permission


Example

Here I assume that project app url is APP_URL=http://project.dev/ts/toys-store

  1. Set the writable permission to storage_path('framework/sessions') the folder.
  2. Check the path of your laravel project 'path' => '/ts/toys-store', the root of your laravel project.
  3. Change the name of your cookie 'cookie' => 'toys-store',
return [
    'driver' => env('SESSION_DRIVER', 'file'),
    'lifetime' => 120,
    'expire_on_close' => false,
    'encrypt' => false,
    'files' => storage_path('framework/sessions'),
    'connection' => null,
    'table' => 'sessions',
    'lottery' => [2, 100],
    'cookie' => 'toys-store',
    'path' => '/ts/toys-store',
    'domain' => null,
    'secure' => false,
    'http_only' => true,
];