php - ReflectionException:文件中不存在类 Tymon\JWTAuth\Http\Middleware\Authenticate
问题描述
我正在尝试使用令牌(在邮递员中)获取用户详细信息。但我收到错误:
ReflectionException: Class Tymon\JWTAuth\Http\Middleware\Authenticate does not exist in file C:\xampp\htdocs\sistema\vendor\laravel\framework\src\Illuminate\Container\Container.php on line 779
我的应用程序\Http\Kernel.php
protected $routeMiddleware= [
...
'auth.jwt' => \Tymon\JWTAuth\Http\Middleware\Authenticate::class,
...
];
我的配置\app.php
'providers' => [
...
Tymon\JWTAuth\Providers\LaravelServiceProvider::class,
Tymon\JWTAuth\Providers\JWTAuthServiceProvider::class,
...
],
我的项目github:https ://github.com/vika0/project
解决方案
我修改了我放在后面的另一个文件:
您需要这样做,因为此错误已在开发分支中修复,但未在主分支中修复,因此请更改插件的某些内容。
composer require tymon/jwt-auth:dev-develop --prefer-source
app/Http/Kernel.php(替换你那里的那个)
'auth.jwt' => \Tymon\JWTAuth\Http\Middleware\Authenticate::class
配置/jwt.php
'jwt' => 'Tymon\JWTAuth\Providers\JWT\Namshi',
/*
|--------------------------------------------------------------------------
| Authentication Provider
|--------------------------------------------------------------------------
|
| Specify the provider that is used to authenticate users.
|
*/
'auth' => 'Tymon\JWTAuth\Providers\Auth\Illuminate',
/*
|--------------------------------------------------------------------------
| Storage Provider
|--------------------------------------------------------------------------
|
| Specify the provider that is used to store tokens in the blacklist
|
*/
'storage' => 'Tymon\JWTAuth\Providers\Storage\Illuminate',
配置/app.php
'providers' => [
/*
* Laravel Framework Service Providers...
*/
Illuminate\Auth\AuthServiceProvider::class,
Illuminate\Broadcasting\BroadcastServiceProvider::class,
Illuminate\Bus\BusServiceProvider::class,
Illuminate\Cache\CacheServiceProvider::class,
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
Illuminate\Cookie\CookieServiceProvider::class,
Illuminate\Database\DatabaseServiceProvider::class,
Illuminate\Encryption\EncryptionServiceProvider::class,
Illuminate\Filesystem\FilesystemServiceProvider::class,
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
Illuminate\Hashing\HashServiceProvider::class,
Illuminate\Mail\MailServiceProvider::class,
Illuminate\Notifications\NotificationServiceProvider::class,
Illuminate\Pagination\PaginationServiceProvider::class,
Illuminate\Pipeline\PipelineServiceProvider::class,
Illuminate\Queue\QueueServiceProvider::class,
Illuminate\Redis\RedisServiceProvider::class,
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
Illuminate\Session\SessionServiceProvider::class,
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
//Remove both lines because for me worked without them
//Tymon\JWTAuth\Providers\JWTAuthServiceProvider::class,
/*
* Package Service Providers...
*/
/*
* Application Service Providers...
*/
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
],
在 storage/framework 内部,您需要创建各种文件夹,即 storage/framework/ session和 storage/framework/ views
毕竟需要做这个命令:
php artisan jwt:secret
[已编辑]
我现在看到了这个屏幕:
我希望那是你想要的
推荐阅读
- sql - 基于与 CTE 连接的更新列值
- python - 替换文本中的空格(多行)
- asp.net - 允许 nuget 下载 Azure AppService 中缺少的包
- c# - 了解 Parallel.For 循环和局部变量
- ansible - 嵌套的 jinja2 dns 查询
- python - 支持向量机中的奇怪错误“ValueError:'x'不能用于播种 numpy.random.RandomState 实例”?
- node.js - Alexa 技能向错误的技能发送请求
- c++ - 如何构造一个类型特征来判断一种类型的私有方法是否可以在另一种类型的构造函数中调用?
- angular - Angular - 在两个库之间导入模块
- firebase-cloud-messaging - 如何在 Firebase 云功能中指定声音和 click_action