mirror of
https://github.com/koel/koel
synced 2024-11-10 06:34:14 +00:00
Fix HTTP error code when bad authentication to 401
…instead of 400/404, so client can deal with it correctly (#537)
This commit is contained in:
parent
2bd4b79a04
commit
9f11a7111e
1 changed files with 2 additions and 2 deletions
|
@ -19,7 +19,7 @@ class GetUserFromToken extends BaseMiddleware
|
|||
public function handle($request, Closure $next)
|
||||
{
|
||||
if (!$token = $this->auth->setRequest($request)->getToken()) {
|
||||
return $this->respond('tymon.jwt.absent', 'token_not_provided', 400);
|
||||
return $this->respond('tymon.jwt.absent', 'token_not_provided', 401);
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -31,7 +31,7 @@ class GetUserFromToken extends BaseMiddleware
|
|||
}
|
||||
|
||||
if (!$user) {
|
||||
return $this->respond('tymon.jwt.user_not_found', 'user_not_found', 404);
|
||||
return $this->respond('tymon.jwt.user_not_found', 'user_not_found', 401);
|
||||
}
|
||||
|
||||
$this->events->fire('tymon.jwt.valid', $user);
|
||||
|
|
Loading…
Reference in a new issue