C# JWT令牌过期未设置为所需时间

C# JWT令牌过期未设置为所需时间,c#,.net-core,jwt,asp.net-core-webapi,C#,.net Core,Jwt,Asp.net Core Webapi,我在.Net核心应用程序中使用JWT,并且使用System.IdentityModel.Tokens.JWT(5.6.0) 我尝试按如下方式设置过期时间: var token = new JwtSecurityToken( "www.site.com", "www.site.com", claims, expires: DateTime.UtcNow.AddMinute

我在.Net核心应用程序中使用JWT,并且使用System.IdentityModel.Tokens.JWT(5.6.0) 我尝试按如下方式设置过期时间:

var token = new JwtSecurityToken(
                "www.site.com",
                "www.site.com",
                claims,
                expires: DateTime.UtcNow.AddMinutes(5),
                signingCredentials: credentials);
我的电脑的时间是下午2点38分,代币对地产价值的验证时间是晚上9点43分。 必须是下午2点43分

我的Startup.cs配置如下:

services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
        .AddJwtBearer(options =>
        {
            options.TokenValidationParameters = new TokenValidationParameters
            {
                ClockSkew = TimeSpan.Zero,
                ValidateIssuer = true,
                ValidateAudience = true,
                ValidateLifetime = true,
                ValidateIssuerSigningKey = true,
                ValidIssuer = Configuration["Authentication:Issuer"],
                ValidAudience = Configuration["Authentication:Issuer"],
                IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(Configuration["Authentication:Secret"]))
            };
        });
这是什么原因?
谢谢你的帮助

您居住的时区是UTC-7<代码>日期时间.UtcNow 返回UTC时间,使用
DateTime。现在改为