Fix timestamp serialization format for JWT tokens

This commit is contained in:
ErickSkrauch 2024-12-03 18:17:42 +01:00
parent 2442329895
commit 8a25ff9223
No known key found for this signature in database
GPG Key ID: 669339FCBB30EE0E

View File

@ -62,7 +62,7 @@ class Component extends BaseComponent {
*/ */
public function create(array $payloads = [], array $headers = []): UnencryptedToken { public function create(array $payloads = [], array $headers = []): UnencryptedToken {
$now = Carbon::now(); $now = Carbon::now();
$builder = (new Builder(new JoseEncoder(), ChainedFormatter::default()))->issuedAt($now->toDateTimeImmutable()); $builder = (new Builder(new JoseEncoder(), ChainedFormatter::withUnixTimestampDates()))->issuedAt($now->toDateTimeImmutable());
if (isset($payloads['sub'])) { if (isset($payloads['sub'])) {
$builder = $builder->relatedTo($payloads['sub']); $builder = $builder->relatedTo($payloads['sub']);
} }