I'm trying to get ASP.NET Boilerplate with Module Zero (both MVC and AngularJS version) to authenticate against our Office 365/Azure AD system, without success. I've been working on it for two months, bought books on Azure AD Authentication and sought much help from friends but I'm at the end of my rope and my project is stalled. (Thanks for letting me rant...)
First: Tried adding UseOpenIdConnectAuthentication in a method similar to your Facebook and Google auth code in Startup.cs.
Result: Transfers to my O365 login page before displaying AspNetBoilerplate login page. On callback it gets stuck in a loop and doesn't display any registration or login option.
Second: Per another thread in this forum on Azure AD I rearranged the OWIN modules in startup.cs.
Result: I get the login page, click on "Use OpenIDConnect", login on my Azure AD page, get sent to the callback, and get an HTTP 400.0 error that the antiforgery token is not present or is invalid.
Third: Copied the code from the other Azure AD thread very closely.
At one point I had the callback seemingly working but the problem I had then was AuthenticationManager.GetExternalLoginInfoAsync() would return null. Since then I started from scratch and this time I'm not able to get even that far.
My current code for web.startup.configuration:
ClientId = "9cf42fd3-48ee-4b37-b53d-(redacted)",
Authority = "https://login.microsoft.com/(mydomain).onmicrosoft.com",
PostLogoutRedirectUri = "https://localhost:44356/",
CallbackPath = new PathString("/Account/ExternalLoginCallback")
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login")
I've tried what I can but I just don't have enough experience with OWIN to get this to work. I'm sorry to bother you with this but can you provide me with some guidance? With the exploding popularity of Office 365 and Azure AD it seems to me that Azure AD authentication would be a hugely useful feature for many of your users and would be a great feature to integrate into your codebase.