infinite loop going back to authentication page when using OAuth in MVC5

前端 未结 2 1009
猫巷女王i
猫巷女王i 2021-02-06 02:57

I have written a webpage that takes advantage of Google/Facebook auth using MVC5 and OAuth.

Sometimes, I\'m able to auth very well using either Facebook or Google. It w

相关标签:
2条回答
  • 2021-02-06 03:36

    this is a major issue where randomly your application will start going into an infinite loop and some times redeploying the application makes it work but only temporary. the quick way i found to address this issue is using nuget package kentor.owincookiesaver as commented by @cooper. you should make a call to this class before cookieauthentication call in the owin startup class as shown below

    app.UseKentorOwinCookieSaver();
    
    app.UseCookieAuthentication(new CookieAuthenticationOptions());
    

    Apparently there is a bug in owin and katana where your cookie just disappear and this fixes it.

    0 讨论(0)
  • 2021-02-06 03:42

    To resolve this issue: you can upgrade your application to use ASP.NET Core. If you must continue stay on ASP.NET, perform the following:

    Update your application’s Microsoft.Owin.Host.SystemWeb package be at least version and Modify your code to use one of the new cookie manager classes, for example something like the following:

    app.UseCookieAuthentication(new CookieAuthenticationOptions 
    { 
        AuthenticationType = "Cookies", 
        CookieManager = new Microsoft.Owin.Host.SystemWeb.SystemWebChunkingCookieManager() 
    });
    

    Reference Link

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