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 ?

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top