title: Manually validating a JWT token in C#
body: <p>I am having some trouble <strong>manually validating</strong> a JWT token issued by Identity Server 4. Using the </p>
  
  <p>ClientId: "CLIENT1"
  ClientSecret: "123456"</p>
  
  <p>The exception I keep getting is: IDX10501: Signature validation failed. Unable to match keys: '[PII is hidden by default. Set the 'ShowPII' flag in IdentityModelEventSource.cs to true to reveal it.]'</p>
  
  <p>Is anyone able to advise me where I am going wrong.</p>
  
  <pre><code>    private static void ValidateJwt(string jwt, DiscoveryResponse disco)
      {        
  
          var parameters = new TokenValidationParameters
          {
  
              ValidateIssuerSigningKey = true,
              ValidIssuer = disco.Issuer,
              IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes("123456")),               
              ValidAudience = "CLIENT1",
              //IssuerSigningKeys = keys,
              // ValidateAudience = true,
              // ValidateLifetime = true,
          };
  
          SecurityToken validatedToken;
          var handler = new JwtSecurityTokenHandler();
          handler.InboundClaimTypeMap.Clear();
  
          try
          {
              var user = handler.ValidateToken(jwt, parameters, out validatedToken);
          }
          catch(Exception ex)
          {
              var error = ex.Message;
          }
  
      }
  </code></pre>