我的应用程序正在正常运行,我正在使用流明6.3.5和jwt 1.0.0-rc5 当我再次部署应用程序并安装作曲家时,出现此错误
PHP Fatal error: Uncaught InvalidArgumentException: Auth driver [jwt] for guard [api] is not defined. in /var/www/html/proj/vendor/illuminate/auth/AuthManager.php:97
Stack trace:
#0 /var/www/html/proj/vendor/illuminate/auth/AuthManager.php(68): Illuminate\Auth\AuthManager->resolve('api')
#1 /var/www/html/proj/vendor/illuminate/auth/AuthManager.php(307): Illuminate\Auth\AuthManager->guard()
#2 /var/www/html/proj/app/Exceptions/Handler.php(44): Illuminate\Auth\AuthManager->__call('user', Array)
#3 /var/www/html/proj/vendor/sentry/sentry/src/State/Hub.php(98): App\Exceptions\Handler->App\Exceptions\{closure}(Object(Sentry\State\Scope))
#4 /var/www/html/proj/vendor/sentry/sentry/src/functions.php(78): Sentry\State\Hub->configureScope(Object(Closure))
#5 /var/www/html/proj/app/Exceptions/Handler.php(48): Sentry\configureScope(Object(Closure))
#6 /var/www/html/proj/vendor/laravel/lumen-framework/src/Concerns/RegistersExceptionHandlers.php(122): App\Exce in /var/www/html/proj/vendor/illuminate/auth/AuthManager.php on line 97
现在我无法执行任何工匠命令,例如(php artisan cache:clear或php artisan jwt:secret) 每次我尝试执行任何操作时,都会遇到相同的错误。 顺便说一下,代码正在100%正常工作,而我正在使用jwt。
这是我的bootstrap / app.php:
$app->routeMiddleware([
'auth' => App\Http\Middleware\Authenticate::class,
'throttle' => App\Http\Middleware\ThrottleRequests::class,
]);
$app->withFacades(true, [
Tymon\JWTAuth\Facades\JWTAuth::class => 'JWTAuth',
Tymon\JWTAuth\Facades\JWTFactory::class => 'JWTFactory',
]);
$app->register(App\Providers\AuthServiceProvider::class);
$app->register(Tymon\JWTAuth\Providers\LumenServiceProvider::class);
这是认证文件:
'defaults' => [
'guard' => env('AUTH_GUARD', 'api'),
'passwords' => 'users',
],
'guards' => [
'api' => [
'driver' => 'jwt',
'provider' => 'users',
],
],
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\User::class,
],
],
就像我之前说过的那样,我的代码可以100%工作,但是在为新的部署安装composer之后,我得到了这个错误。