-1

I am struggling with the problem of the laravel session. This page works on the problem bases on the server, but when I moved it to the new one and changed the domain, during login or registration, I get an error

The page has expired due to inactivity.
Please refresh and try again.

I send the token correctly in the meta tag and in the form. On the old server, the page still works correctly, when I downloaded files from it and uploaded to localhost, the same error occurs. I've already dug all threads in various forums but nothing helped.

I am asking for help and thank you in advance.

  <?php

return [



    'driver' => env('SESSION_DRIVER', 'file'),



    'lifetime' => env('SESSION_LIFETIME', 120),

    'expire_on_close' => false,


    'encrypt' => false,



    'files' => storage_path('framework/sessions'),



    'connection' => null,


    'table' => 'sessions',


    'store' => null,


    'lottery' => [2, 100],


    'cookie' => env(
        'SESSION_COOKIE',
        str_slug(env('APP_NAME', 'laravel'), '_').'_session'
    ),



    'path' => '/',


    'domain' => env('SESSION_DOMAIN', null),



    'secure' => env('SESSION_SECURE_COOKIE', false),



    'http_only' => true,



    'same_site' => null,

];

1 Answers1

1

You can except that route as below :

1) Please ensure that you have added {{ csrf_field() }} in form

or

2) Go to app\Http\Middleware\VerifyCsrfToken.php and Add below

class VerifyCsrfToken extends Middleware
{
    /**
     * The URIs that should be excluded from CSRF verification.
     *
     * @var array
     */
    protected $except = [
        '/job-listing','logout','apply-job' // Your routes
    ];
}
Rahul Pawar
  • 1,016
  • 1
  • 8
  • 25