Open yousefAK opened 4 years ago
Same issue here.
Laravel 8.0 PHP 7.4 tymon/jwt-auth: ^1.0
In laravel 8.0, same issue if i set default to "api", but if i use Auth::guard('api'), the error will be "Method Illuminate\Auth\SessionGuard::factory does not exist."
Same here!!!!!!Any answer???
Same problem here while installing Laravel Masterpass plugin.
same here
no solutions yet ?
For me this happened after I upgraded to Laravel 7. According to the upgrade guide App\Exceptions\Handler
now uses Throwable
instead of Exception
. If you have traits used in this handler, update those too.
This worked for me https://github.com/tymondesigns/jwt-auth/issues/1886#issuecomment-538448309 on Laravel 6.0
Leave the default guard as it is and do this:
'defaults' => [
'guard' => 'web',
'passwords' => 'users',
],
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'api' => [
'driver' => 'jwt',
'provider' => 'users',
'hash' => false,
],
],
Then just call:
auth('api')->attempt([....etc
Leave the default guard as it is and do this:
'defaults' => [ 'guard' => 'web', 'passwords' => 'users', ], 'guards' => [ 'web' => [ 'driver' => 'session', 'provider' => 'users', ], 'api' => [ 'driver' => 'jwt', 'provider' => 'users', 'hash' => false, ], ],
Then just call:
auth('api')->attempt([....etc
THANKS FRIEND
I solved the problem by adding this line to the providers in app.php
Tymon\JWTAuth\Providers\LaravelServiceProvider::class,
and here is guards I have:
`
'defaults' => [
'guard' => 'web',
'passwords' => 'users',
],
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'api_customer' => [
'driver' => 'jwt',
'provider' => 'api_customer',
],`
after following @RichieMcMullen 's solution now my error becomes Method Illuminate\Auth\SessionGuard::factory does not exist.
anyone found the solution?
after following @RichieMcMullen 's solution now my error becomes Method Illuminate\Auth\SessionGuard::factory does not exist.
anyone found the solution?
If you follow @RichieMcMullen's solution and then also add the ServiceProvicer as @AbdulrazakZakieh suggestes it will work fine.
Auth driver [jwt] for guard [api] is not defined.
Your environment
My Application was working without any error, i am using lumen 6.3.5 and jwt 1.0.0-rc5 when i deploy the application again and make composer install, i get this error
now i cannot make any artisan command like (php artisan cache:clear) every time i try to do anything i get the same error. by the way the code was working 100% and i was using jwt.
this is my bootstrap/app.php:
and this is the auth file: