Skip to content

Commit 398ccd2

Browse files
authored
fix: only check iat if nbf is not used (#493)
1 parent 6c8f5e7 commit 398ccd2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/JWT.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public static function decode(
156156
// Check that this token has been created before 'now'. This prevents
157157
// using tokens that have been created for later use (and haven't
158158
// correctly used the nbf claim).
159-
if (isset($payload->iat) && $payload->iat > ($timestamp + static::$leeway)) {
159+
if (!isset($payload->nbf) && isset($payload->iat) && $payload->iat > ($timestamp + static::$leeway)) {
160160
throw new BeforeValidException(
161161
'Cannot handle token prior to ' . \date(DateTime::ISO8601, $payload->iat)
162162
);

0 commit comments

Comments
 (0)