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 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;