From c7a2e79ce97c6ee827f08969bfb969b226c19d4a Mon Sep 17 00:00:00 2001 From: nick <924056326@qq.com> Date: Sat, 24 Dec 2022 17:40:00 +0800 Subject: [PATCH 1/2] Update TokenGuard.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复无参数值请求时,getBasicAuthorization $header默认值类型错误引发的异常 --- src/Guards/TokenGuard.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Guards/TokenGuard.php b/src/Guards/TokenGuard.php index c199582..5100743 100644 --- a/src/Guards/TokenGuard.php +++ b/src/Guards/TokenGuard.php @@ -162,7 +162,7 @@ protected function getBearerToken(): ?string */ protected function getBasicAuthorization(): array { - $header = $this->request->header('Authorization'); + $header = $this->request->header('Authorization', ''); if (Str::startsWith($header, 'Basic ')) { try { From 802fae817ad8e8a9ac3251d9d05b8b46910edde0 Mon Sep 17 00:00:00 2001 From: nick <924056326@qq.com> Date: Sat, 24 Dec 2022 17:46:33 +0800 Subject: [PATCH 2/2] Update TokenGuard.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加容错 --- src/Guards/TokenGuard.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Guards/TokenGuard.php b/src/Guards/TokenGuard.php index 5100743..c73e76a 100644 --- a/src/Guards/TokenGuard.php +++ b/src/Guards/TokenGuard.php @@ -93,7 +93,7 @@ public function user(): ?AuthenticatableInterface /** * Get the token for the current request. */ - public function getTokenForRequest(): string + public function getTokenForRequest(): string|null { $token = $this->request->query($this->inputKey);