Reputation: 1650
I am using HTML pages for UI purpose in laravel and when I try to login then it shows me an error page "TokenMismatchException in VerifyCsrfToken.php line 53:". I am getting this error while login as well as registration. I have the login.html page as follows:
<div class="container">
<form method="POST" action="login_display" accept-charset="UTF-8">
<h1>Login</h1>
<hr>
<div class="form-group">
<label for="email">Email ID :</label>
<input class="form-control" name="email" type="text" id="email" placeholder="Please enter email here">
</div>
<div class="form-group">
<label for="password">Password :</label>
<input class="form-control" name="password" type="password" value="" id="password" placeholder="Please enter password here">
</div>
<div class="form-group">
<input class="btn btn-primary form-control" type="submit" value="Login">
</div>
</form>
</div>
Upvotes: 0
Views: 451
Reputation: 1650
I tried by adding following line to the form:
<input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
and this time it works well and I didn't get the TokenMismatchException error afterwards as well.
Upvotes: 1
Reputation: 32734
Try adding, <input type="hidden" name="_token" value="{{ csrf_token() }}">
to your form. Laravel uses this token to check that the form submission was valid.
Upvotes: 2