安装了 jwt 运行 php artisan route:list 时出现问题
problem while running php artisan route:list with jwt installed
我已经学习了这个教程
https://tutsforweb.com/restful-api-in-laravel-56-using-jwt-authentication/
它工作正常,
但是当我尝试 运行
php artisan route:list
我收到这个错误,
Tymon\JWTAuth\Exceptions\JWTException : The token could not be parsed from the request
at F:\My_Projects\Laravel\api-laravel-jwt\vendor\tymon\jwt-auth\src\JWT.php:185
181| */
182| public function parseToken()
183| {
184| if (! $token = $this->parser->parseToken()) {
> 185| throw new JWTException('The token could not be parsed from the request');
186| }
187|
188| return $this->setToken($token);
189| }
Exception trace:
1 Tymon\JWTAuth\JWT::parseToken()
F:\My_Projects\Laravel\api-laravel-jwt\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php:223
2 Illuminate\Support\Facades\Facade::__callStatic("parseToken", [])
F:\My_Projects\Laravel\api-laravel-jwt\app\Http\Controllers\ProductController.php:14
Please use the argument -v to see more details.
我一直在尝试绕过它,但没有成功,有什么帮助吗?
这是一个 github 代码库:-
在产品控制器中,在这部分:-
public function __construct()
{
$this->user = JWTAuth::parseToken()->authenticate();
}
它调用解析令牌,这就是它转到 jwt 身份验证解析令牌并在那里失败的原因。
因此,虽然没有提供经过身份验证的用户,但它会失败。
希望这有帮助。
我已经学习了这个教程 https://tutsforweb.com/restful-api-in-laravel-56-using-jwt-authentication/ 它工作正常, 但是当我尝试 运行
php artisan route:list
我收到这个错误,
Tymon\JWTAuth\Exceptions\JWTException : The token could not be parsed from the request
at F:\My_Projects\Laravel\api-laravel-jwt\vendor\tymon\jwt-auth\src\JWT.php:185
181| */
182| public function parseToken()
183| {
184| if (! $token = $this->parser->parseToken()) {
> 185| throw new JWTException('The token could not be parsed from the request');
186| }
187|
188| return $this->setToken($token);
189| }
Exception trace:
1 Tymon\JWTAuth\JWT::parseToken()
F:\My_Projects\Laravel\api-laravel-jwt\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php:223
2 Illuminate\Support\Facades\Facade::__callStatic("parseToken", [])
F:\My_Projects\Laravel\api-laravel-jwt\app\Http\Controllers\ProductController.php:14
Please use the argument -v to see more details.
我一直在尝试绕过它,但没有成功,有什么帮助吗?
这是一个 github 代码库:-
在产品控制器中,在这部分:-
public function __construct()
{
$this->user = JWTAuth::parseToken()->authenticate();
}
它调用解析令牌,这就是它转到 jwt 身份验证解析令牌并在那里失败的原因。 因此,虽然没有提供经过身份验证的用户,但它会失败。 希望这有帮助。