lundi 15 avril 2019

laravel 5: "Session store not set on request." in api.php

I get user data via this link:

https://www.example.com/api/v1/user?api_token=e0220d90-e6e4-11a2-bddd-c6a491dff8e7mb

and in api.php

Route::group(['prefix' => 'v1', 'namespace' => 'API\v1','middleware' => 'auth:api'], function () {
  Route::get('/user' , 'AuthController@user');
});

when api_token is true, it return me user data.

but when api_token is false, it return me an error:

"Session store not set on request."

I try add this code in end of api.php to handle wrong api_token

Route::fallback(function () {
    return response(['status' => 403]);
});

But again,I get same error

what is my problem?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire