I\'m getting this error in Login Controller.
InvalidOperationException: Unable to resolve service for type \'Microsoft.AspNetCore.Identity.UserManager
This is a bit unrelated to the original post but since Google brings you here... if you are getting this error and are using:
services.AddIdentityCore()
Then you will need to manually register the stuff that AddIdentity does, which can be found here:
https://github.com/aspnet/Identity/blob/feedcb5c53444f716ef5121d3add56e11c7b71e5/src/Identity/IdentityServiceCollectionExtensions.cs#L79
services.AddHttpContextAccessor();
// Identity services
services.TryAddScoped, UserValidator>();
services.TryAddScoped, PasswordValidator>();
services.TryAddScoped, PasswordHasher>();
services.TryAddScoped();
services.TryAddScoped, RoleValidator>();
// No interface for the error describer so we can add errors without rev'ing the interface
services.TryAddScoped();
services.TryAddScoped>();
services.TryAddScoped>();
services.TryAddScoped, UserClaimsPrincipalFactory>();
services.TryAddScoped>();
services.TryAddScoped>();
services.TryAddScoped>();
You'll need to replace TUser and TRole with your implementations of those, or the default IdentityUser, IdentityRole