Identityserver4 关闭浏览器后令牌被洗掉
我已经在我的系统中集成了Identity server,现在我想保留Identity server令牌,以便用户在浏览器关闭后不必重新登录 这是我的密码Identityserver4 关闭浏览器后令牌被洗掉,identityserver4,aspnetboilerplate,Identityserver4,Aspnetboilerplate,我已经在我的系统中集成了Identity server,现在我想保留Identity server令牌,以便用户在浏览器关闭后不必重新登录 这是我的密码 //Identity server if (bool.Parse(_appConfiguration["IdentityServer:IsEnabled"])) { IdentityServerRegistrar.Register(services, _appConfiguration);
//Identity server
if (bool.Parse(_appConfiguration["IdentityServer:IsEnabled"]))
{
IdentityServerRegistrar.Register(services, _appConfiguration);
//BHARAT : JWT Authentication Middleware
services.AddAuthentication().AddIdentityServerAuthentication("IdentityBearer", options =>
{
options.Authority = _appConfiguration["App:ServerRootAddress"];
options.RequireHttpsMetadata = false;
options.ApiName = "default-api";
options.ApiSecret = "def2edf7-5d42-4edc-a84a-30136c340e13".Sha256();
options.CacheDuration = TimeSpan.FromMinutes(30);
options.SaveToken = true;
});
}
我试着跟着这个
这是浏览器中令牌的快照
我尝试了许多其他方法来保存cookie/令牌,但它不起作用
我需要在客户端添加任何内容吗?我正在使用.net core 2.0的angular版本。尝试在以下位置更改条件:
//之前
var tokenExpireDate=回忆
? (新日期(新日期().getTime()+1000*expireInSeconds))
:未定义;
//之后
var tokenExpireDate=expireInSeconds
? (新日期(新日期().getTime()+1000*expireInSeconds))
:未定义;
是的,aaron成功了,事实上,以前我的代币存储为会话cookie,现在它具有时间跨度。。谢谢你的快速帮助。。