Tive varios erros ao decorrer dessa aula, fiz algumas mudanças, algumas praticamente não sei explicar, mas pode estar ajudando vocês
Principalmente nesse erro aqui (Unable to resolve service for type 'Microsoft.EntityFrameworkCore.Storage.Type Mapping Source Dependencies' while attempting to activate 'MySql.EntityFrameworkCore.Storage.Internal.MySQLTypeMappingSource)
UserDbContext
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
namespace UsuariosApi.Data
{
public class UserDbContext : IdentityDbContext<IdentityUser>
{
public UserDbContext(DbContextOptions<UserDbContext> opt) : base(opt)
{
}
}
}
appsettings.json
"ConnectionStrings": {
"UsuarioConnection": "server=localhost;database=usuarioDb;user=root;password=root"
}
Program.cs
builder.Services.AddDbContext<UserDbContext>(options => options
.UseMySql(builder.Configuration.GetConnectionString("UsuarioConnection"), new MySqlServerVersion(new Version(8, 0))));
builder.Services.AddIdentity<IdentityUser, IdentityRole>()
.AddEntityFrameworkStores<UserDbContext>()
.AddDefaultTokenProviders();
builder.Services.AddAuthorization();
Depois no final do arquivo program, adicionar também
app.UseAuthentication();
app.UseAuthorization();