大佬教程收集整理的这篇文章主要介绍了asp.net – GetExternalLoginInfoAsync()loginInfo返回null – 但仅在几个小时后,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
如果你有一个strava帐户,你可能会在这里遇到问题:fartslek.no/Account/Login
public void ConfigureAuth(IAppBuilder app) { // Configure the db context,user manager and signin manager to use a single instance per request app.CreatePerOwinContext(ApplicationDbContext.Create); app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create); app.CreatePerOwinContext<ApplicationSignInManager>(ApplicationSignInManager.Create); // Enable the application to use a cookie to store information for the signed in user // and to use a cookie to temporarily store information about a user logging in with a third party login provider // Configure the sign in cookie app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,LoginPath = new PathString("/Account/Login"),Provider = new CookieAuthenticationProvider { // Enables the application to validate the security stamp when the user logs in. // This is a security feature which is used when you change a password or add an external login to your account. OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager,ApplicationUser>( validateInterval: TimeSpan.FromMinutes(30),regenerateIdentity: (manager,user) => user.GenerateUserIdentityAsync(manager)) },CookieManager = new SystemWebCookieManager() }); app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie); app.UseTwoFactorSignInCookie(DefaultAuthenticationTypes.TwoFactorCookie,TimeSpan.FromMinutes(5)); app.UseTwoFactorRememberBrowserCookie(DefaultAuthenticationTypes.TwoFactorRememberBrowserCookie); app.UseStravaAuthentication( new StravaAuthenticationOptions{ ClientId="XXX",ClientSecret= "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",}); }
我正在使用这个https://github.com/Johnny2Shoes/Owin.Security.Strava来获得StravaAuth.
当它停止工作时,天蓝色的重置是不够的,但是如果我进行新的部署,一切都会工作一段时间.
我正在使用Owin 3.0.1和Mvc 5.2.3
This issue被提交给Katana团队,但看起来他们根本不会修复它.有很多解决方法,但这是我能找到的最简单的方法:
[HttpPost] [AllowAnonymous] [ValidateAntiForgeryToken] public ActionResult ExternalLogin(string provider,string returnUrl) { ControllerContext.HttpContext.Session.RemoveAll(); // Request a redirect to the external login provider return new ChallengeResult(provider,Url.Action("ExternalLoginCallback","Account",new { ReturnUrl = returnUrl })); }
有关此错误的更多详细信息,请参阅this问题,如果适合您,请告诉我.
以上是大佬教程为你收集整理的asp.net – GetExternalLoginInfoAsync()loginInfo返回null – 但仅在几个小时后全部内容,希望文章能够帮你解决asp.net – GetExternalLoginInfoAsync()loginInfo返回null – 但仅在几个小时后所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。