[英]DefaultAuthenticationTypes.ApplicationCookie persist after server reboot
I am using mvc 5 with external log in with facebook, but after every server reboot, the user would be logged out of the system. 我正在使用mvc 5与facebook进行外部登录,但每次重启服务器后,用户都将退出系统。 That defeats the purpose of oAuth? 这违背了oAuth的目的? I can't find any properties to make them persist through reboots 我找不到任何属性,让它们通过重新启动持续存在
this is how the startup.auth looks like.. 这就是startup.auth的样子......
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/External"),
ExpireTimeSpan = new TimeSpan(30, 0, 0, 0),
SlidingExpiration = true
});
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
是的,所以相当于记住我的密码登录不是默认模板中的一个选项,基本上你可以通过在ExternalLoginCallback中将isPersistent更改为true来做到这一点
await SignInAsync(user, isPersistent: false);
If the web.config
file uses the default auto-generated settings, the server's encryption keys will change each time the web server restarts. 如果web.config
文件使用默认的自动生成设置,则每次Web服务器重新启动时,服务器的加密密钥都将更改。 To fix this the machineKey
element needs to have fixed key values. 要解决此问题, machineKey
元素需要具有固定的键值。
An online machineKey
generator: http://aspnetresources.com/tools/machineKey 在线machineKey
生成器: http : //aspnetresources.com/tools/machineKey
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.