Presados, preciso que alguém me ajude a entender pq essa excessão é lançada em meu codigo.
System.NotSupportedException: No IUserTwoFactorTokenProvider named 'Default' is registered.
Metodo de cadastro!
public Result CadastraUsuario(CriarUsuarioDto criaDto)
{
Usuario usuario = _mapper.Map<Usuario>(criaDto);
IdentityUser<int> usuarioIdentity = _mapper.Map<IdentityUser<int>>(usuario);
Task<IdentityResult> resultado = _userManager.CreateAsync(usuarioIdentity, criaDto.Password);
if (resultado.Result.Succeeded)
{
var code = _userManager.GenerateEmailConfirmationTokenAsync(usuarioIdentity).Result;
return Result.Ok().WithSuccess(code);
}
return Result.Fail("Falha ao cadastrar usuário!");
`
ConfigureServices
` public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<AuthDbContext>(opts => opts.UseSqlServer(Configuration.GetConnectionString("SqlServer")));
services.AddIdentity<IdentityUser<int>, IdentityRole<int>>().AddEntityFrameworkStores<AuthDbContext>();
services.Configure<IdentityOptions>(options =>
{
options.Password.RequireUppercase = true;
options.Password.RequiredLength = 8;
options.Password.RequireNonAlphanumeric = true;
options.User.RequireUniqueEmail = true;
options.SignIn.RequireConfirmedEmail = true;
});
services.AddControllers();
services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());
services.AddScoped<CadastroService, CadastroService>();
services.AddScoped<LoginService, LoginService>();
services.AddScoped<TokenServices, TokenServices>();
services.AddScoped<LogoutService, LogoutService>();
}`