Token mismatch when changing session driver in Laravel 4

≯℡__Kan透↙ 提交于 2019-12-04 06:15:57

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!