title: Laravel 5 Auth Post Submit - TokenMismatchException in VerifyCsrfToken.php line 46
body: <p>Have just statred a new app in Laravel 5 and I am having some trouble using the out of the box auth...</p>
  
  <p>I keep getting : TokenMismatchException in VerifyCsrfToken.php line 46:
  on submitting the login or signup forms...</p>
  
  <p>I can see on the login form page the token codes that are in the hidden form field and Session at that point are the same...</p>
  
  <p>As a test I have also tried as some other posts suggested commenting out 
  //'App\Http\Middleware\VerifyCsrfToken', in app/Http/kernal.php to see what would happen. After doing this every time I submit a form I get a message which says redirecting to: /auth/login or /auth/register depending on where I came from with no success.</p>
  
  <p>The weird thing was this was working when I first installed the framework. All I have done since then is run a few migrations and setup some of my models and controllers and seeded the db with some user data.</p>
  
  <p>UPDATE:</p>
  
  <p>Looking into this further in the function tokensMatch() on line 55 of VerifyCsrfToken.php if I :</p>
  
  <pre><code>var_dump($request-&gt;session()-&gt;token());
  
  var_dump($request-&gt;input('_token'));
  </code></pre>
  
  <p>I can see the two tokens are different but at the form using:</p>
  
  <pre><code>var_dump(Session::all());
  
  {{{ csrf_token() }}}
  </code></pre>
  
  <p>They are the same. The Session token has changed some how before it gets to the function tokensMatch() on line 55 of VerifyCsrfToken.php</p>
  
  <p>My stack trace is as follows:</p>
  
  <pre><code>in VerifyCsrfToken.php line 46
  at VerifyCsrfToken-&gt;handle(object(Request), object(Closure)) in VerifyCsrfToken.php line 17
  at VerifyCsrfToken-&gt;handle(object(Request), object(Closure)) in Pipeline.php line 125
  at Pipeline-&gt;Illuminate\Pipeline\{closure}(object(Request)) in ShareErrorsFromSession.php line 55
  at ShareErrorsFromSession-&gt;handle(object(Request), object(Closure)) in Pipeline.php line 125
  at Pipeline-&gt;Illuminate\Pipeline\{closure}(object(Request)) in StartSession.php line 61
  at StartSession-&gt;handle(object(Request), object(Closure)) in Pipeline.php line 125
  at Pipeline-&gt;Illuminate\Pipeline\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 36
  at AddQueuedCookiesToResponse-&gt;handle(object(Request), object(Closure)) in Pipeline.php line 125
  at Pipeline-&gt;Illuminate\Pipeline\{closure}(object(Request)) in EncryptCookies.php line 40
  at EncryptCookies-&gt;handle(object(Request), object(Closure)) in Pipeline.php line 125
  at Pipeline-&gt;Illuminate\Pipeline\{closure}(object(Request)) in CheckForMaintenanceMode.php line 42
  at CheckForMaintenanceMode-&gt;handle(object(Request), object(Closure)) in Pipeline.php line 125
  at Pipeline-&gt;Illuminate\Pipeline\{closure}(object(Request))
  at call_user_func(object(Closure), object(Request)) in Pipeline.php line 101
  at Pipeline-&gt;then(object(Closure)) in Kernel.php line 111
  at Kernel-&gt;sendRequestThroughRouter(object(Request)) in Kernel.php line 84
  at Kernel-&gt;handle(object(Request)) in index.php line 53
  </code></pre>