title: JWT Validation fails
body: <p>I have created a JwtToken by setting up the Payload as shown below</p>
  
  <pre><code>var payload = new JwtPayload
          {
              {"aud", "wellmark.com" },
              {"iss", "wellmark" },
              {"iat", DateTime.Now.Ticks },
              {"exp", DateTime.Now.AddDays(90).Ticks },
          };
  </code></pre>
  
  <p>The reason I had to use ticks is because that is the only way to get an integer value for the issued at and expiration times. I agree that ticks is in fact a long and not an int, but that was the only way. </p>
  
  <p>Now when I come back to validate the token, I am doing the below</p>
  
  <pre><code>var tokenValidationParams = new TokenValidationParameters
              {
                  IssuerSigningKey = new X509SecurityKey(jwtCert),
                  ValidAudience = "masked",
                  ValidIssuer = "masked",
                  IssuerSigningKeyResolver = (string token, Microsoft.IdentityModel.Tokens.SecurityToken securityToken, string kid, TokenValidationParameters validationParameters) =&gt; new List&lt;X509SecurityKey&gt; { new X509SecurityKey(jwtCert) }
              };
  
              tokenHandler.ValidateToken(id, tokenValidationParams
                     , out validatedToken);
  </code></pre>
  
  <p>It is however failing saying </p>
  
  <blockquote>
    <p>Lifetime validation failed. The token is missing an Expiration Time.
    Tokentype: 'System.IdentityModel.Tokens.Jwt.JwtSecurityToken'.</p>
  </blockquote>
  
  <p>This is most likely because the validation method is trying to convert the long to an int and because it is unable to convert it, it simply returns a null as indicated in the documentation shown  <a href="https://msdn.microsoft.com/en-us/library/system.identitymodel.tokens.jwtpayload.expiration(v=vs.114).aspx" rel="noreferrer">here</a>.</p>
  
  <p>Has anyone had success with this mechanism. Please note that I am using X509 Certificate to Sign my Jwt.</p>
  
  <p>Narasimham</p>