asp.net – GetExternalLoginInfoAsync()loginInfo返回null –
发布时间:2020-12-15 20:42:17 所属栏目:asp.Net 来源:网络整理
导读:我正在使用Strava作为我的外部登录提供商(我认为这与Strava无关,也可能是google或facebook)运行几小时/几天甚至几周后,GetExternalLoginInfoAsync返回null.我已经阅读了同样问题的一堆其他问题,但没有找到解决方案.我发布了我的整个ConfigureAuth方法,以防我
我正在使用Strava作为我的外部登录提供商(我认为这与Strava无关,也可能是google或facebook)运行几小时/几天甚至几周后,GetExternalLoginInfoAsync返回null.我已经阅读了同样问题的一堆其他问题,但没有找到解决方案.我发布了我的整个ConfigureAuth方法,以防我在订单上做错了.
如果你有一个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 解决方法
我有同样的问题.谷歌搜索了一下后,我发现这是Owin的一个已知错误,因为他们处理cookie的方式.
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是多线程的(它如何执行请求)
- ASP.NET MVC 3 jQuery验证;禁用不引人注意的OnKeyUp?
- asp.net – 防止用户在同一行上工作
- ASP.net MVC ASP.net Identity Seeding角色和用户
- asp.net core 2.0 – 多个项目解决方案docker文件
- asp.net-mvc – 无法加载文件或程序集Oracle.DataAccess
- 在ASP.NET MVC视图页面中放置jQuery代码的位置?
- asp.net-mvc-3 – MVC3 – 如何输出要下载的文件而不先将其
- asp.net-mvc-4 – 来自程序集’mscorlib的WebAPI RC’Syste
- asp.net-mvc – MVC中具有存储库/ DTO模式的实体的部分更新
推荐文章
站长推荐
- ASP.Net使用状态服务器和缓存增加MaxProcesses(W
- asp.net-mvc-4 – 使用angularjs和ASP.NET MVC
- 如何保护我的ASP.NET AJAX应用程序?
- asp.net-mvc – 基于Microsoft.AspNet.Identity角
- asp.net-mvc-3 – [显示(提示MVC3
- ASP.NET MVC – jquery datepicker
- 回发后用F5写的asp.net问题,因为它做了应有的事情
- asp.net Web项目中使用Log4Net进行错误日志记录
- 在ASP.NET MVC中使用HttpContext.Current.Sessio
- asp.net-mvc – ASP.NET MVC – 能够处理数组的自
热点阅读