laravel5.8
我的composer.json
"tymon/jwt-auth": "dev-develop"
kernel.php
protected $routeMiddleware = [
/*
* jwt
*/
'jwt.auth' => 'Tymon\JWTAuth\Middleware\GetUserFromToken',
'jwt.refresh' => 'Tymon\JWTAuth\Middleware\RefreshToken',
'jwt.admin' => '\App\Http\Middleware\AdminCheck::class',
];
但是 enter image description here
没有GetUserFromToken.php
,但是如果我没有请求令牌,它将返回401,我不知道为什么
config/auth.php
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'api' => [
'driver' => 'jwt',
'provider' => 'users',
//'hash' => false,
],
],
路线
/routes/web.php
Route::group(['middleware' => 'jwt.auth'], function () {
//Route::get('logout','UserController@logout')->name('UserLogout');
Route::get('profile','UserController@getAuthInfo')->name('UserInfo');
Route::post('password/reset','UserController@resetPassword')->name('ResetPassword');
Route::get('select','UserController@SelectUser')->name('SelectUser');
});