Support the ongoing development of Laravel.io →
Installation Authentication
Last updated 1 year ago.
0

on every post request laravel sends a token, this is also stored on the session, laravel matches the token on the request with the one on the session if the tokens mismatch this exception occurs.

https://laravel.com/docs/5.3/csrf

0

astroanu said:

on every post request laravel sends a token, this is also stored on the session, laravel matches the token on the request with the one on the session if the tokens mismatch this exception occurs.

https://laravel.com/docs/5.3/csrf

@astroanu thanks for reply :) how could it be mismatched? i installed most defaultly. and used php artisan make auth. and then i served my app. but appears error like that.

0

is it right sessiontoken changed on every time i did refresh page?

0

If you are sending data via html form, try including {{csrf_token()}}. This will generate a token that will be sent with your form

0

its just default auth login from

<form class="form-horizontal" role="form" method="POST" action="{{ url('/login') }}"> {{ csrf_field() }}
0

when i press refresh =>

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

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

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

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



    echo $sessionToken; /this token changes every time i refresh/
    echo '<br>';
    echo $token; /this token not changes /

    return hash_equals($sessionToken, $token);
}
0

is there any solution on windows?

0

on every action refresh click register login etc there is a new session file created in storage/framework/sessions folder.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

et4m1r et4m1r Joined 16 Nov 2016

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.