I am using ASP.NET Identity with ASP.NET core and I have:
services.AddIdentity<User, Role>();
This works fine when I login. But then I tried this setup:
services
.AddIdentity<User, Role>(x => {
x.Cookies = new IdentityCookieOptions {
ApplicationCookie = new CookieAuthenticationOptions {
AccessDeniedPath = new PathString("/signin"),
AuthenticationScheme = "cookies",
AutomaticAuthenticate = true,
AutomaticChallenge = true,
CookieName = "_ath",
LoginPath = new PathString("/signin"),
LogoutPath = new PathString("/signout")
}
};
})
.AddEntityFrameworkStores<Context, Int32>()
.AddDefaultTokenProviders();
With this I get the following error:
No authentication handler is configured to handle the scheme:
Microsoft.AspNet.Identity.Application
Note that I have AuthenticationScheme = "cookies"
, AutomaticAuthenticate = true
and AutomaticChallenge = true
.
I also have the following in Starttup / Configure method:
applicationBuilder
.UseIdentity()
.UseMvc(routes => { routes.MapRoute(name: "default", template: "{controller=Home}/{action=Index}/{id?}"); })
So I suppose I am using the default order ...
Does anyone knows what am I missing?