I wrote a webpage that uses Google / Facebook features using MVC5 and OAuth
sometimes, I can use Facebook or Google very well. It works quite well.
However, it often happens that
- Go to the login page
- Choose either google or facebook
- provide account information, get the necessary redirects
- redirect back to login page but not log in
I am not getting (or not looking in the right place) any errors that tell me: I use SSL on Azure for hosting
Does anyone have any tips on why it sometimes works and sometimes not? Does it look like it could be a cookie problem or a server side configuration problem? I cannot understand why this sometimes works and sometimes does not work.
I tried
- using a second machine that has never been logged in before (for the rule cookies), the same problem
- clearing cookie cache, same problem
How am I configured:
public void ConfigureAuth(IAppBuilder app) { // Enable the application to use a cookie to store information for the signed in user app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, LoginPath = new PathString("/Account/Login") }); // Use a cookie to temporarily store information about a user logging in with a third party login provider app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie); // Uncomment the following lines to enable logging in with third party login providers //app.UseMicrosoftAccountAuthentication( // clientId: "", // clientSecret: ""); //app.UseTwitterAuthentication( // consumerKey: "", // consumerSecret: ""); app.UseFacebookAuthentication( appId: "abc", appSecret: "123"); app.UseGoogleAuthentication(); }
I followed this guide to use OAuth in MVC5 ( http://www.asp.net/mvc/tutorials/mvc-5/create-an-aspnet-mvc-5-app-with-facebook-and-google- oauth2-and-openid-sign-on) j
stuck
source share