Alright?
I'm here again with a new problem ... I'm using Laravel 5.5 and in this process I'm having problems with the routes using the API middleware.
For example, my web.php file is as follows
<?php
Route::get('/', function () {
return view('welcome');
});
Route::group(['middleware' => ['cors', 'api'], 'prefix' => 'api'], function()
{
Route::get('/', function () {
return response()->json(['message' => 'Jobs API', 'status' => 'Connected']);;
});
Route::post('auth/login', 'AuthController@login');
});
I'm testing via PostMan routes, if I put the route
http://192.168.15.253:8091/sys-pesquisa/public/api/
I have the following return:
{
"message": "Jobs API",
"status": "Connected"
}
If I try to access the "POST" route (auth / login) I get the following message:
The page has expired due to inactivity.
Please refresh and try again.
I noticed that if I change from POST to GET leaving ..
Route::get('auth/login' .........
I have the positive feedback:
{"result":false,"errors":["The senha field is required.","The usuario field is required."]}
But as that is an API that is going to be accessed via mobile application need to be sent via POST.
Finally, I have no idea what it might be, I researched and found some things talking about the 'VerifyCsrfToken' class, even adding it to the VerifyCsrfToken class:
protected $except = [
'api/*'
];
But I did not succeed ... Can anyone help me?
Thank you guys!