GetExternalLoginInfoAsync () loginInfo retorna nulo - mas somente após algumas horas
Estou usando o Strava como meu provedor de logon externo (presumo que isso não esteja relacionado ao Strava, também pode ser o google ou o facebook). Depois de executar por algumas horas / dias ou até semanas, o retorno de GetExternalLoginInfoAsync é nulo. Li várias outras perguntas com o mesmo problema, mas não encontrei uma solução. Publico todo o método ConfigureAuth, caso tenha feito algo errado com o pedido.
Se você possui uma conta strava, provavelmente poderá encontrar o problema aqui: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",
});
}
Estou usando issohttps://github.com/Johnny2Shoes/Owin.Security.Strava para obter o StravaAuth.
Quando ele pára de funcionar, uma redefinição do azul não é suficiente, mas se eu fizer uma nova implantação tudo funcionará por um tempo.
Estou usando o Owin 3.0.1 e o Mvc 5.2.3