Skip to content

Commit

Permalink
Merge pull request #244 from DiovaneGabriel/fix/use-id-claim
Browse files Browse the repository at this point in the history
Fix/use id claim
  • Loading branch information
Messhias authored Apr 8, 2024
2 parents f794dbe + 68db345 commit a4faded
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/JWTAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a4faded

Please sign in to comment.