I'm implementing mechanizm to manage tokens in my application and I use such code to create JwtSecurityToken
var securityTokenDescriptor = new SecurityTokenDescriptor()
{
Subject = claims,
SigningCredentials = signingCredentials,
Expires = DateTime.UtcNow.AddMinutes(ACCESS_TOKEN_LENGHT_MINUTES),
IssuedAt = DateTime.UtcNow
};
var tokenJwt = tokenHandler.CreateJwtSecurityToken(securityTokenDescriptor);
And unexpectedly dates in 'tokenJwt' are different, than in securityTokenDescriptor
Both 'ValidTo' with 'Expires' and 'ValidFrom' with 'IssuedAt' differ in exactly one hour.
I suppose it's connected with changing time between Summer/Winter times (Currently it's a winter time) or with fact, that I live in UTC +1:00 time zone.
I tried using both DateTime.Now and DateTime.UtcNow but there is the same problem with both of them
Does anyone knows why it is happening like this and knows the solution of these problem?