C
C#13mo ago
Yume

❔ How to generate JSON Web Token with custom header field?

I'm using System.IdentityModel.Tokens.Jwt. So far generating the token seems easy enough but the API I'm integrating with requires a custom field in the header. How can I do this with JwtHeader class? I see a signature with "additionalInnerHeaderClaims" but it also requires an "outboundAlgorithmMap" which I don't know how to use. https://learn.microsoft.com/en-us/dotnet/api/system.identitymodel.tokens.jwt.jwtheader.-ctor?view=msal-web-dotnet-latest#system-identitymodel-tokens-jwt-jwtheader-ctor(microsoft-identitymodel-tokens-signingcredentials-system-collections-generic-idictionary((system-string-system-string))-system-string-system-collections-generic-idictionary((system-string-system-object)))
JwtHeader Constructor (System.IdentityModel.Tokens.Jwt) - Microsoft...
Initializes a new instance of the JwtHeader class. Default string comparer Ordinal.
4 Replies
JakenVeina
JakenVeina13mo ago
SecurityTokenDescriptor.AdditionalHeaderClaims Property (Microsoft....
Gets or sets the Dictionary which contains any custom header claims that need to be added to the JWT token header. The 'alg', 'kid', 'x5t', 'enc', and 'zip' claims are added by default based on the SigningCredentials, EncryptingCredentials, and/or CompressionAlgorithm provided and SHOULD NOT be included in this dictionary as this will result in ...
Accord
Accord13mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server
More Posts