GetExternalLoginInfoAsync() loginInfo return null - but only after a few hours

前端 未结 1 2116
挽巷
挽巷 2021-02-09 13:29

I\'m using Strava as my external login provider (I assume this is not related to Strava, could be google or facebook also) After running for a few hours / days or even weeks Get

相关标签:
1条回答
  • 2021-02-09 13:57

    I had the same problem. After googling a little, I've discovered this is a known bug in Owin, because of the way they handle cookies.

    This issue was submitted to Katana Team, but it looks they won't fix it at all. There are many workarounds for this, but this was the simplest I could find:

        [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 }));
        }
    

    See this question for more details about this bug, and let me know if this works well for you.

    0 讨论(0)
提交回复
热议问题