I'm recieving the following error:
{"A claim of type 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier' or 'http://schemas.microsoft.com/accesscontrolservice/2010/07/claims/identityprovider' was not present on the provided ClaimsIdentity. To enable anti-forgery token support with claims-based authentication, please verify that the configured claims provider is providing both of these claims on the ClaimsIdentity instances it generates. If the configured claims provider instead uses a different claim type as a unique identifier, it can be configured by setting the static property AntiForgeryConfig.UniqueClaimTypeIdentifier."}
I have tried Anti-forgery token issue (MVC 5) with no success.
Error is occuring on
@Html.AntiForgeryToken()
Generic Startup.cs
public class Startup
{
public void Configuration(IAppBuilder app)
{
AuthConfig.ConfigureAuth(app);
}
}
Admin Controller Login Method
[HttpPost]
public ActionResult Login(Models.AdminUserLogin LoginModel)
{
if (ModelState.IsValid)
{
if (isUserValid(LoginModel.EmailAddr, LoginModel.Password))
{
List<Claim> claims = new List<Claim>
{
new Claim(ClaimTypes.Email, LoginModel.EmailAddr),
//some other claims
};
ClaimsIdentity identity = new ClaimsIdentity(claims, AuthConfig.DefaultAuthType);
IAuthenticationManager authManager = Request.GetOwinContext().Authentication;
authManager.SignIn(new AuthenticationProperties() { IsPersistent = true }, identity);
return RedirectToAction("Manage");
}
else
{
ModelState.AddModelError("", "Username and/or password incorrect");
}
}
return View(LoginModel);
}
Any ideas would be very appreciated.