TokenMismatchException in VerifyCsrfToken.php Line 67
I'm assuming you added $this->middleware('auth');
inside the constructor of your controller to get the authentication working. In your login/register forms, if you are using {!! Form::someElement !!}
, add the following line at the top as well:
{!! csrf_field() !!}
Or if you are using input tags inside your forms, just add the following line after <form>
tag:
<input type="hidden" name="_token" value="{{ csrf_token() }}">
Hope this helps.
I had a similar issue and it was an easy fix.
Add this in your HTML meta tag area :
<meta name="csrf-token" content="{{ csrf_token() }}">
Then under your JQuery reference, add this code :
<script type="text/javascript">
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
</script>
If you are using the HTML form submit (not AJAX) then you need to put :
{{ csrf_field() }}
inside your form tags.