0

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?

Areza
  • 671
  • 14
  • 26
  • 1
    Possible duplicate of [Laravel - Session store not set on request](https://stackoverflow.com/questions/34449770/laravel-session-store-not-set-on-request) – Alex Mayo Apr 15 '19 at 15:21
  • 1
    Session is not set within api routes as apis should be stateless. – thisiskelvin Apr 15 '19 at 15:45

0 Answers0