From a483cf629df239a1f1cdff9ed86d8db4040b9e5d Mon Sep 17 00:00:00 2001 From: Diovane Date: Fri, 5 Apr 2024 22:28:03 -0300 Subject: [PATCH 1/2] check id if subject was not found --- src/JWTAuth.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/JWTAuth.php b/src/JWTAuth.php index a383886d..23137b13 100644 --- a/src/JWTAuth.php +++ b/src/JWTAuth.php @@ -57,7 +57,7 @@ public function attempt(array $credentials) */ public function authenticate() { - $id = $this->getPayload()->get('sub'); + $id = $this->getPayload()->get('sub') ?: $this->getPayload()->get('id'); if (!$this->auth->byId($id)) { return false; From 68db345b5d9ac85d510136e2879b4ea11f152da9 Mon Sep 17 00:00:00 2001 From: Diovane Date: Fri, 5 Apr 2024 22:37:02 -0300 Subject: [PATCH 2/2] add to changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d2de10e..e08dfc90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,9 @@ You can find and compare releases at the GitHub release page. ### Removed - Dropped support for Laravel < 10 and PHP < 8.1 +### Fixed +- Use `id` claim for identify user if `sub` doesn't exists. + ## [2.2.0] 2024-03-12 ### Added