本文介绍了永不过期的不记名令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以定义永不过期的ASP.NET Web API 2承载令牌?有任何线索吗?
Is it possible define that ASP.NET Web API 2 bearer token that never expires? Any clue?
推荐答案
我不认为您可以将其设置为永不过期,但是您当然可以设置更长的AccessTokenExpireTimeSpan
:
I don't think you can set it to never expire but you could certainly set a longer AccessTokenExpireTimeSpan
:
OAuthOptions = new OAuthAuthorizationServerOptions
{
TokenEndpointPath = new PathString("/Token"),
Provider = new ApplicationOAuthProvider(PublicClientId, UserManagerFactory),
AuthorizeEndpointPath = new PathString("/api/Account/ExternalLogin"),
AccessTokenExpireTimeSpan = TimeSpan.FromDays(14),
AllowInsecureHttp = true
};
app.UseOAuthBearerTokens(OAuthOptions);
这篇关于永不过期的不记名令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!