Skip to content

Commit d1a0780

Browse files
committed
Fix issue with token generation via DateTimeImmutable instead of int (dependency with lcobucci/jwt ^5.0)
1 parent 02ea57f commit d1a0780

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Subscriber/AdditionalAccessTokenClaimsAndHeaderSubscriber.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,16 @@ public static function getSubscribedEvents(): array
2929

3030
public function addClaims(JWTCreatedEvent $event): void
3131
{
32+
$now = new \DateTimeImmutable();
33+
3234
$claims = [
3335
'jti' => uniqid('', true),
34-
'iat' => time(),
35-
'nbf' => time(),
36+
'iat' => $now,
37+
'nbf' => $now,
3638
];
3739
$data = $event->getData();
3840
if (!array_key_exists('exp', $data) && $this->ttl > 0) {
39-
$claims['exp'] = time() + $this->ttl;
41+
$claims['exp'] = $now->modify(sprintf('+%d second',$this->ttl));
4042
}
4143
$event->setData(array_merge($claims, $data));
4244
}

0 commit comments

Comments
 (0)