We are trying to introduce Microsoft Authentication to our app using the ASP.NET 5 Web Application Template.
The default template takes the user from the login link in _LoginPartial.cshtml
to the Login page where they select their preferred authentication provider. We only want to accept Microsoft authentication so we want _LoginPartial.cshtml
to log the user in.
I have modified _LoginPartial.cshtml
<ul class="nav navbar-nav navbar-right">
@*<li><a asp-controller="Account" asp-action="Register">Register</a></li>*@
<li><a asp-controller="Account" asp-action="ExternalLogin">Log in</a></li>
</ul>
I have also changed the provider parameter of AccountController ExternalLogin
public IActionResult ExternalLogin(string provider="Microsoft", string returnUrl = null)
{
// Request a redirect to the external login provider.
var redirectUrl = Url.Action("ExternalLoginCallback", "Account", new { ReturnUrl = returnUrl });
var properties = _signInManager.ConfigureExternalAuthenticationProperties(provider, redirectUrl);
return new ChallengeResult(provider, properties);
}
But in my case ExternalLogin
is not called and a blank page
http://localhost:52711/Account/ExternalLogin
is returned.
What am I doing wrong?