title: IDX10501: Signature validation failed. kid: '[PII is hidden]', token: '[PII is hidden]' - Azure B2C
body: <p>I have created a sample application where the user can authenticate with Azure B2C which works fine. I get back the Token and the AuthenticationResult. Both are Ok. But I want to get back the ClaimPrincipal from the token. To do this I have added the System.IdentityModel.Tokens.Jwt (5.4.0) nuget package to the project.</p>
  
  <p>With the following code I try to achieve:</p>
  
  <pre><code>string Token = "eyJ0eXAiOiJKV1QiLCJhbGciO*****"; //long token
  JwtSecurityTokenHandler jwt = new JwtSecurityTokenHandler();
  
  var validateParams = new Microsoft.IdentityModel.Tokens.TokenValidationParameters()
          {
            ValidIssuer = Authority, //https://login.microsoftonline.com/tfp/MYTEANANTNAME.onmicrosoft.com/MYPOLICYNAME/v2.0/" 
            ValidAudience = clientId,  //CLIENTID: Like: b430xxxx-xxxx-xxxx-xxxx-f5c33cxxxxxx
            ValidateAudience = true,
            ValidateLifetime = true,
            ValidateIssuer = true,
          };
  
  SecurityToken secToken;
  var claimPrincipal = jwt.ValidateToken(Token, validateParams , out secToken);
  </code></pre>
  
  <p>But all the time when the ValidateToken is hit it throws the following exception:</p>
  
  <pre><code>IDX10501: Signature validation failed. Unable to match keys: 
  kid: '[PII is hidden]', 
  token: '[PII is hidden]'.
  </code></pre>
  
  <p>Do you have any advice how I should resolve this issue?</p>
  
  <p>In this case the application is a .net core console app, but in the end this code will be in an WPF application.</p>