Hi,
I'm having a problem when I want to build an API application. Each time when I try to send a POST request to my API, I get the TokenMismatchException. So I wondered why this is happening to me, because the Token middleware exists only in the web group. so I checked the route:list and I so this result:
https://i.gyazo.com/8ba1d6cc0fcf93514b1c5645f7442087.png
As u can see, I have web,api in each route. why is that?
routes.php
<?php
Route::group(['middleware' => ['web']], function () {
// Route::auth();
});
Route::group(['middleware' => ['api'], 'prefix' => 'api/v1'], function () {
Route::group(['prefix' => 'users'], function () {
Route::post('register', ['as' => 'user.register', 'uses' => 'UsersController@postRegister']);
Route::post('login', ['as' => 'user.login', 'uses' => 'UsersController@postLogin']);
Route::get('authenticate', ['as' => 'user.authenticate', 'uses' => 'UsersController@getAuthenticatedUserFromToken']);
});
});
Why do I have the web middleware and not only the api middleware?