user5300195
user5300195

Reputation:

laravel 5.1 error TokenMismatchException in VerifyCsrfToken.php line 53:

I try to authentication users. I type code and do steps like documentation laravel but have the error. This is my form

enter code here

{!! csrf_field() !!} 
First Name Last Name E-mail Address Sport: {{ $gametype }}>   
@foreach($games as $game) 
    <input type="checkbox" value="{{ old('game_type_id') }}"> {{ $game->name }}>
@endforeach 

Password Password Confirmation I agree with terms of use Sign Up Sign Up or Connect with Connect with Already have an account? Sign In!

This is route: // Authentication routes...

Route::get('auth/login', 'Auth\AuthController@getLogin');
Route::post('auth/login', 'Auth\AuthController@postLogin');      
Route::get('auth/logout', 'Auth\AuthController@getLogout');

// Registration routes...

Route::get('auth/register', 'Auth\AuthController@getRegister'); 
Route::post('auth/register', 'Auth\AuthController@postRegister');

My files login and register blade are in view/auth folder. When I registered get this error TokenMismatchException in VerifyCsrfToken.php line 53:

Upvotes: 0

Views: 1136

Answers (1)

Mehrdad Hedayati
Mehrdad Hedayati

Reputation: 1454

According to the official documentation here, you have to use and input field with the current token.

<input type="hidden" name="_token" value="{{csrf_token()}}" />

and use Route::controller('auth','AuthController'); instead of all your current routes.

Upvotes: 1

Related Questions