79443610

Date: 2025-02-16 17:25:58
Score: 0.5
Natty:
Report link

For those who are looking for RSA (asymmetric keys), You can set the key id while constructing the security credentials (below snippet shows an example).

var accessTokenDescription = new SecurityTokenDescriptor
{
    Issuer = "https://example.in",
    IssuedAt = DateTime.UtcNow,
    NotBefore = DateTime.UtcNow,
    Expires = DateTime.UtcNow.AddSeconds(accessTokenExpiry),
    SigningCredentials = new SigningCredentials(new RsaSecurityKey(rsa)
    {
        KeyId = "hello-world"
    }, SecurityAlgorithms.RsaSsaPssSha256)
};

When the token is generated, it will have kid in the JWT header like below:

Decoded JWT showing the kid in header

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Aravindh Kumar