Tymon JWTAUTH从令牌中排除路由



我安装了laravel 5.6并配置了tymon jwtauth令牌。

一切都很顺利。

在laravel 5.1中,我使用此函数将函数从jwt身份验证中排除:

public function __construct() {
$this->middleware('jwt.auth', ['except' => ['login']]);
}

也尝试过:

public function __construct() {
$this->middleware('jwt.auth')->except([
'login'
]);
}

它在laravel 5.6中不起作用,知道吗?我想取消登录功能,这样用户就可以登录,获取令牌并在每次请求时发送它。

protected $routeMiddleware = [
'jwt.auth' => 'TymonJWTAuthMiddlewareGetUserFromToken',
'jwt.refresh' => 'TymonJWTAuthMiddlewareRefreshToken',
]

我把这个放在

受保护的$中间件

在api.php中,我把我的路线不在web.php 中

Route::post('user/register', 'APIRegisterController@register');
Route::post('user/login', 'APILoginController@login');
Route::middleware('jwt.auth')->get('testFunc', 'testController@testFunc');

最新更新