I\'m playing a with JwtTokens and can\'t make them work properly. I\'m using http://www.nuget.org/packages/System.IdentityModel.Tokens.Jwt/ for it. I know the code is a mess
Found the issue. The validation parameters have a default clock skew of 5 minutes
/// <summary>
/// Default for the clock skew.
///
/// </summary>
///
/// <remarks>
/// 300 seconds (5 minutes).
/// </remarks>
public static readonly TimeSpan DefaultClockSkew;
Setting that to 0 make this work. Still don't understand why the skew is 5 minutes, if I set the expiry at some point!!!
This will definitely works
TimeSpan.FromSeconds(0) Resets ClockSkew Time to zero
TokenValidationParameters parameters = new TokenValidationParameters()
{
RequireExpirationTime = true,
ValidateIssuer = false,
ValidateAudience = false,
ClockSkew= TimeSpan.FromSeconds(0)
};