Question

I have problem with Laravel CSRF.

I test my code in native session driver and everything is OK. but while I change session driver to redis, token mismatch error happens.

I also tried to clear cache. but not working.

this is my form

{{ Form::open(array( 'route' => 'login' )) }}

    {{ Form::text('email') }}

    {{ Form::password('password') }}

    {{ Form::submit('Login') }}

{{ Form::close() }}

this is my route

Route::post('login', array('as' => 'login', 'before' => 'csrf', 'uses' => 'UserController@login') );

any help ?

Was it helpful?

Solution

Verify that the session is indeed being stored to Redis.

If the session lifetime is set to transient (0 = Expire-on-close) in your configuration, the keystore will be empty and no CSRF token may be matched.

If the data is present in Redis, verify the token being sent against the one that is expected using e.g. Firebug to inspect POST form data.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top