So, obviously the token printed out by csrf_field is different from the token obtained from the session. How is this possible?
Feb 25, 2016
9
Level 1
CSRF Token Mismatch when moved to new server
I started a project on my local machine. I am able to login fine there. I do have the {{csrf_field()}} inside my login form.
I set up a remote server for testing and I am getting this error when logging in.
TokenMismatchException in VerifyCsrfToken.php line 67:
in VerifyCsrfToken.php line 67
at VerifyCsrfToken->handle(object(Request), object(Closure))
at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing{closure}(object(Request)) in ShareErrorsFromSession.php line 49
at ShareErrorsFromSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
The project run's fine on mine and another developer's machine. The only difference is our servers are windows and the test server is linux. Any ideas on what could be happening?
I am using the out of the box login. This declaration is in the web middleware Route::auth();
Level 65
Have you got anything different with the way you have your domain? HTTPS or a change in the session.php settings? If you have secure => true, it will do that on a HTTP request.
5 likes
Please or to participate in this conversation.