1

I called Form::open its work and showing _token

{!! Form::open(['url' => URL::route('admin-login'), 'method' => 'post', 'class' => 'form-horizontal m-t-20']) !!}

<form method="POST" action="http://example.net/admin/login" accept-charset="UTF-8" class="form-horizontal m-t-20"><input name="_token" type="hidden" value="7ybw31c2ruMTjquv2lbyFAoIg1jBVySeQzBdrP">

session.php file

return [

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

    //'lifetime' => 120,
    'lifetime' => 120*30*24*10,
    //'lifetime' => 360,
    'expire_on_close' => false,
    'encrypt' => false,
    'files' => storage_path('framework/sessions'),
    'connection' => null,
    'table' => 'sessions',
    'lottery' => [2, 100],
    'cookie' => 'laravel_session',
    'path' => '/',
    'domain' => null,
    'secure' => false,
    'http_only' => true,
];

I just dump the session token and form token value. both tokens are having different value

This session token changed on every refresh in server and remain same in localhost

protected function tokensMatch($request)
{
    $sessionToken = $request->session()->token();

    $token = $request->input('_token') ?: $request->header('X-CSRF-TOKEN');

    var_dump($sessionToken);
    var_dump($token,true); die;

    if (! $token && $header = $request->header('X-XSRF-TOKEN')) {
        $token = $this->encrypter->decrypt($header);
    }

    if (! is_string($sessionToken) || ! is_string($token)) {
        return false;
    }

    return hash_equals($sessionToken, $token);
}

RESULT OF VAR DUMP

var_dump($sessionToken);
EQ0oX12dMLLvI86MIb385vJ3e3U1DaIWiUVpt7Zx


var_dump($token,true); 
7ybw31c2ruMTjquv2lbyFAoIg1jBVySeQzBdrP

Following step I have tried but issue not solved

this issue happens in only server in and works fine in localhost

-Re-upload complete project from local to live

-Checked File Permission in Storage/Session directory (working fine and generating files)

-Cleared artisan cache

and also tried steps from TokenMismatchException in VerifyCsrfToken.php Line 67

Solution from TokenMismatchException in VerifyCsrfToken.php

Solution: issue solved after restarting server.

Community
  • 1
  • 1
user3151197
  • 347
  • 1
  • 3
  • 14

0 Answers0