私は外部ログインプロバイダとしてStravaを使用しています(これはStravaとは関係がないと仮定していますが、GoogleやFacebookでも可能です)日または週GetExternalLoginInfoAsync return null。私は同じ問題で他にもたくさんの質問を読んだが、解決策は見つけられなかった。注文に何か問題があった場合に備えて、私はConfigureAuthメソッド全体を投稿します。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",
});
}
私はStravaAuthを得るために、このhttps://github.com/Johnny2Shoes/Owin.Security.Stravaを使用しています。
晴天のリセットは十分ではありませんが、私が新しい配備を行うとしばらくの間、すべての機能が動作します。
私はOwin 3.0.1と
コードがどこかにディスク上の不正な認証データをキャッシュしているのだろうかと思います。サイトを再デプロイすると、ディスク上のすべてのファイルが削除され、新しいファイルに置き換えられます。これにより、認証がその後に開始される理由が説明されます。単にサイトをリセットしても何もしません。 –
興味深い理論。どのようなアイデアをチェックする? – Larsi
@ZainRizviこれをお探ししていただきありがとうございます。それは、認証のデフォルトの実装を持つプレーンなmvcサイトです。私が行った唯一の変更は、外部認証プロバイダとしてStravaを追加することです。問題が何であるか把握する手助けがあれば本当にうれしいでしょう。再度、お時間をいただきありがとうございます – Larsi