-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
There is some issue with JSON Serialize that happens when i try New-Jwt.
I receive the following error:
Line |
53 | $jwt = New-JWT -Payload $payload -Algorithm $alg -Secret $key
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| A possible object cycle was detected. This can either be due to a cycle or if the object depth is larger than
| the maximum allowed depth of 64. Consider using ReferenceHandler.Preserve on JsonSerializerOptions to support
| cycles. Path:
| $.Members.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.Value.OverloadDefinitions.
Here's the snippet:
$payload = [Ordered]@{
"iat" = ([System.DateTimeOffset]::Now).ToUnixTimeSeconds()
"kid" = $islkid
"hsig" = hashSha256($method + "|" + $webtoken)
"data" = $data | ConvertTo-Json
}
$encryption = [jwtTypes+encryption]::SHA256
$algorithm = [jwtTypes+algorithm]::RSA
$alg = [jwtTypes+cryptographyType]::new($algorithm, $encryption)
$jwt = New-JWT -Payload $payload -Algorithm $alg -Secret $key
return $jwt
I checked the payload in case there was something strange, but it looks OK:
[iat, 1673873422]
[kid, \\default\a]
[hsig, <hash_value>]
[data, {}]
How can I resolve this error?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels