Authentication accesstokenexpiretimespan在web Api 2中不工作

Authentication accesstokenexpiretimespan在web Api 2中不工作,authentication,asp.net-web-api2,bearer-token,Authentication,Asp.net Web Api2,Bearer Token,我有一个用WebAPI 2编写的api 我的问题是代币过期了 我将AccessTokenExpireTimeSpan设置为14天,但token将在20分钟后过期 如何修复它 public void ConfigOAuth(IAppBuilder app) { OAuthAuthorizationServerOptions oAuthServerOptions = new OAuthAuthorizationServerOptions() {

我有一个用WebAPI 2编写的api 我的问题是代币过期了 我将AccessTokenExpireTimeSpan设置为14天,但token将在20分钟后过期 如何修复它

 public void ConfigOAuth(IAppBuilder app)
    {
        OAuthAuthorizationServerOptions oAuthServerOptions = new OAuthAuthorizationServerOptions()
        {
            AllowInsecureHttp = true,
            TokenEndpointPath = new PathString("/token"),
            AccessTokenExpireTimeSpan = TimeSpan.FromDays(14),
            Provider = new AuthorizationServerProvider()
        };
        app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);
        // Token Generation
        app.UseOAuthAuthorizationServer(oAuthServerOptions);
        app.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions());

    }

 public override Task TokenEndpoint(OAuthTokenEndpointContext context)
    {
        foreach (KeyValuePair<string, string> property in context.Properties.Dictionary)
        {
            context.AdditionalResponseParameters.Add(property.Key, property.Value);
        }
        context.Properties.ExpiresUtc = DateTime.UtcNow.AddDays(14);
        return Task.FromResult<object>(null);
    }
public void ConfigOAuth(IAppBuilder应用程序)
{
OAuthAuthorizationServerOptions oAuthServerOptions=新的OAuthAuthorizationServerOptions()
{
AllowInsecureHttp=true,
TokenEndpointPath=新路径字符串(“/token”),
AccessTokenExpireTimeSpan=TimeSpan.FromDays(14),
Provider=新授权服务器Provider()
};
app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);
//令牌生成
使用OAuthAuthorizationServer(oAuthServerOptions);
使用OAuthBeareAuthentication(新的OAuthBeareAuthenticationOptions());
}
公共重写任务令牌端点(OAuthTokenEndpointContext)
{
foreach(context.Properties.Dictionary中的KeyValuePair属性)
{
AdditionalResponseParameters.Add(property.Key,property.Value);
}
context.Properties.ExpiresUtc=DateTime.UtcNow.AddDays(14);
返回Task.FromResult(空);
}