Skip to content
ecdsa.com
Microsoft.IdentityModel.JsonWebTokens / System.IdentityModel.Tokens.Jwt (.NET).NET

Error message

IDX10503: Signature validation failed. The token's kid is: '2026-10', but did not match any keys in TokenValidationParameters or Configuration.

Also printed as

  • IDX10503: Signature validation failed. Token does not have a kid. Keys tried:
  • IDX10517: Signature validation failed. The token's kid is missing.
  • Bearer error="invalid_token", error_description="The signature key was not found"

The full text continues with "Keys tried: …", key counts and `[PII of type … is hidden]` placeholders (set `IdentityModelEventSource.ShowPII = true` in development to see them). Checked on 6.36.0, 7.7.1 and 8.23.0: 6.x words it "IDX10503: Signature validation failed. Token does not have a kid. Keys tried: …"; 7.x and 8.x use the wording above, and report a token without `kid` as IDX10517 "The token's kid is missing".

Microsoft.IdentityModel.JsonWebTokens / System.IdentityModel.Tokens.Jwt (.NET) — SecurityTokenSignatureKeyNotFoundException

What it means

The token names its signing key with a `kid`, and no key in `TokenValidationParameters` (`IssuerSigningKey(s)`) or in the configuration downloaded from the authority's JWKS has that key ID. The signature was never computed — there was no candidate key. In ASP.NET Core the client sees `WWW-Authenticate: Bearer error="invalid_token", error_description="The signature key was not found"`.

Why it happens

How to fix it

  1. 1.

    Let the handler fetch keys from the authority

    With `Authority` set, `JwtBearer` downloads the issuer's JWKS through OpenID Connect discovery, refreshes it periodically and also when a token names an unknown key (`RefreshOnIssuerKeyNotFound`, on by default).

    csharp
    builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
        .AddJwtBearer(options =>
        {
            // Keys come from {Authority}/.well-known/openid-configuration -> jwks_uri and are refreshed automatically.
            options.Authority = "https://login.example.com/";
            options.Audience = "api://orders";
        });
  2. 2.

    Reveal the hidden values while debugging

    IdentityModel hides key IDs and token contents in exception text by default. Enable `ShowPII` only in development to see which keys were tried.

    csharp
    // Development only: show the hidden values ([PII of type ... is hidden]) in IDX messages.
    if (builder.Environment.IsDevelopment())
    {
        Microsoft.IdentityModel.Logging.IdentityModelEventSource.ShowPII = true;
    }

Related errors

Browse the full signature error database