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

前端 未结 2 1008
猫巷女王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.

提交回复
热议问题