问题
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 ?
回答1:
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.
来源:https://stackoverflow.com/questions/22154990/token-mismatch-when-changing-session-driver-in-laravel-4