title: Validating JWT with Microsoft's IdentityModel
body: <p>I am trying to validate the following test JWT, the chosen key is 'private' and I can successfully verify it on <a href="https://jwt.io" rel="nofollow noreferrer">https://jwt.io</a></p>
  
  <pre><code>eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJqdGkiOiIyNzFjNmFkYjNhYTk1YTIxZWI3ZTljMTE2OGViNjI2YiIsImlhdCI6MTQ5MDE5NzQ2MCwibmJmIjoxNDkwMTk3NDYwLCJleHAiOjE0OTAyMDEwNjAsIklwIjoiNzkuMjMxLjczLjE1NCIsIk1lbWJlcklkIjoxfQ.P3m7RkXJ9TUiUFJ2bbtiyoL7OXaD7ITq_LsWMCRJj04
  </code></pre>
  
  <p>It seems like Microsoft has changed the JwtSecurityTokenhandler() class and the documentation isn't really up to date. I checked some tutorials and gitpages which used <code>new InMemorySymetricSecurityKey()</code> but this class is not even present anymore.</p>
  
  <p><strong>Nuget Package:</strong> Install-Package System.IdentityModel.Tokens.Jwt (version 5.1.3).</p>
  
  <p>I have created a simple Console application and I tried to validate the given JWT, but I don't know how I should specify the TokenValidationParameters.</p>
  
  <pre><code>static void Main(string[] args)
  {
      var key = "private";
      var jwt = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJqdGkiOiIyNzFjNmFkYjNhYTk1YTIxZWI3ZTljMTE2OGViNjI2YiIsImlhdCI6MTQ5MDE5NzQ2MCwibmJmIjoxNDkwMTk3NDYwLCJleHAiOjE0OTAyMDEwNjAsIklwIjoiNzkuMjMxLjczLjE1NCIsIk1lbWJlcklkIjoxfQ.P3m7RkXJ9TUiUFJ2bbtiyoL7OXaD7ITq_LsWMCRJj04";
  
      var tokenHandler = new JwtSecurityTokenHandler();
      var securityToken = tokenHandler.ReadToken(jwt);
      var validationParameters = new TokenValidationParameters {IssuerSigningKey = new InMemorySymetricSecurityKey()};
      SecurityToken validated;
      tokenHandler.ValidateToken(jwt, validationParameters, out validated);
  
      Console.WriteLine(validated.ToString());
  }
  </code></pre>