Skip to content

Commit

Permalink
fix: only check iat if nbf is not used (firebase#493)
Browse files Browse the repository at this point in the history
  • Loading branch information
croensch authored and shenkimaro committed Jul 7, 2023
1 parent 08d4505 commit 8f0b97c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/JWT.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public static function decode(
// Check that this token has been created before 'now'. This prevents
// using tokens that have been created for later use (and haven't
// correctly used the nbf claim).
if (isset($payload->iat) && $payload->iat > ($timestamp + static::$leeway)) {
if (!isset($payload->nbf) && isset($payload->iat) && $payload->iat > ($timestamp + static::$leeway)) {
throw new BeforeValidException(
'Cannot handle token prior to ' . \date(DateTime::ISO8601, $payload->iat)
);
Expand Down

0 comments on commit 8f0b97c

Please sign in to comment.