I am using laravel 5.4
and using jwt auth
jwt version is jwt-auth "tymon/jwt-auth": "0.5.*"
In auth.php i have
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'api' => [
'driver' => 'jwt',
'provider' => 'users',
],
],
In Api.php i have
Route::post('/login','HomeController@authenticate');
Route::group(['prefix' => 'v2','middleware' => 'auth:api',], function () {
// Authentication Routes...
Route::get('/logout','HomeController@logout');
Route::get('/home','HomeController@home');
});
When i post email and password from postman it will return token .
when i try to acccess
http://localhost/demo/public/api/v2/home
and header i passed Authorization bearer token
I am getting following error in postman
Whoops, looks like something went wrong. (1/1) InvalidArgumentException Auth guard driver [api] is not defined. in AuthManager.php (line 99) at AuthManager->resolve('api') in AuthManager.php (line 70) at AuthManager->guard('api') in Authenticate.php (line 61) at Authenticate->authenticate(array('api'))
can any help me how to fix it
Also i checked follwing issue since its old one Sep 27, 2016 https://github.com/tymondesigns/jwt-auth/issues/860