- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我使用 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 Team,但看起来他们根本不会修复它。有很多解决方法,但这是我能找到的最简单的方法:
[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 - 但仅在几个小时后,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36459051/
我有访问 AuthenticationManager 的私有(private)属性: private IAuthenticationManager AuthenticationManager => H
ExternalLoginInfo loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync(); 为什么这一行必须总是返回
我创建了一个新的 MVC5 Web 应用程序,当我按照官方指南尝试使用 Google 登录时 http://www.asp.net/mvc/overview/security/create-an-as
我结合使用 IdentityServer4 和 ASP .NET Core Identity 来创建联合登录页面。我正在使用的外部提供商之一是通过 Open ID Connect 协议(protoco
当我第一次尝试使用外部提供者登录时返回 null 然后我在提供者中再次按下,一切都很好。我认为是 cookie 的问题,因为当我删除所有 cookie 并重试时会发生错误。 如果我删除所有 Sessi
任何人都可以帮助阐明 Live SDK (v5.6) 的实现与 Microsoft.AspNet.Identity.Owin.dll 中发生的事情吗? 通过以下方式验证成功后返回的用户id: //MV
var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync(); if (loginInfo == null) {
我一直在尝试使用 Google 帐户在 MVC5 应用程序中使用 OWIN 实现外部登录。 如果我已经登录到 google,单击我的应用程序中的 google 按钮就可以了,它会在允许我访问登录信息后
我创建了一个新的 MVC5 Web 应用程序,当我尝试使用 Google 或 Facebook 登录时,调用了 AccountController 中的 ExternalLoginCallback 操
我使用 Strava 作为我的外部登录提供商(我假设这与 Strava 无关,也可能是 google 或 facebook)运行几个小时/天甚至几周后 GetExternalLoginInfoAsyn
更新我的 MVC5 应用程序的 nuget 包后(到目前为止一直正常工作)用于验证我的用户 Facebook 登录的身份验证管理器现在总是返回 null。 我正在 visual studio 2012
我有 ASP.NET 5 项目,我正在使用 Web API 建立外部登录(用于 Facebook 和 Google)。就我而言,我有包含以下代码的 Web API Controller (不是 MVC
OWIN 身份验证有问题。当我尝试使用 Facebook 或 Google 登录时,我总是从 GetExternalLoginInfoAsync() 收到空值。 但是有一些神秘的情况。当我打开 Fid
我正在尝试在 Visual Studio 2013 的新 MVC 5 项目中设置集成的 OWIN WS-Federation (ADFS) 身份验证。 Startup.Auth 中的 WsFedera
我正在尝试使用 dot-net core 2.0 设置 Facebook 身份验证,但在我的ExternalLoginCallbackAsync 方法中,我总是得到 null 作为响应,我已遵循文档,
这个问题已经有答案了: ASP.NET_SessionId + OWIN Cookies do not send to browser (9 个回答) 已关闭5 个月前。 我使用默认的 Visual
我可以使用 this library 在 .NET Core 1 中配置 Instagram 身份验证,但我似乎无法让它在 .NET Core 2 中工作。 似乎没有任何与 .NET Core 2.0
我已经尝试了几乎所有可用的在线解决方案,但仍然无法获得有效的解决方案。我使用 GoogleAuthentication 使用 dotnetcore 3 web API 进行 POC。 我已将 cons
为什么 signinmanager getexternallogininfoasync 方法总是返回 null? 我将 VS2015 与默认的 asp.net 核心(不是框架)项目一起用于具有个人用户
我正在将 SustainSys.Saml2 与 Gluu 服务器集成为我的 IdP。我正在使用开箱即用的脚手架身份页面。当我在 localhost 中运行并查看控制台日志时,一切似乎都可以与 SAML
我是一名优秀的程序员,十分优秀!