Listo para Producción!
All checks were successful
Build and Deploy / remote-build-and-deploy (push) Successful in 16m22s
All checks were successful
Build and Deploy / remote-build-and-deploy (push) Successful in 16m22s
This commit is contained in:
@@ -95,7 +95,7 @@ builder.Services.AddScoped<IReportesService, ReportesService>();
|
|||||||
|
|
||||||
// --- Configuración de Autenticación JWT ---
|
// --- Configuración de Autenticación JWT ---
|
||||||
var jwtSettings = builder.Configuration.GetSection("Jwt");
|
var jwtSettings = builder.Configuration.GetSection("Jwt");
|
||||||
var jwtKey = jwtSettings["Key"] ?? throw new ArgumentNullException("Jwt:Key", "JWT Key not configured in appsettings");
|
var jwtKey = builder.Configuration["JWT_KEY"] ?? jwtSettings["Key"] ?? throw new ArgumentNullException("Jwt:Key", "JWT Key not configured");
|
||||||
var keyBytes = Encoding.ASCII.GetBytes(jwtKey);
|
var keyBytes = Encoding.ASCII.GetBytes(jwtKey);
|
||||||
|
|
||||||
builder.Services.AddAuthentication(options =>
|
builder.Services.AddAuthentication(options =>
|
||||||
@@ -131,11 +131,12 @@ builder.Services.AddCors(options =>
|
|||||||
options.AddPolicy(name: MyAllowSpecificOrigins,
|
options.AddPolicy(name: MyAllowSpecificOrigins,
|
||||||
policy =>
|
policy =>
|
||||||
{
|
{
|
||||||
policy.WithOrigins("http://localhost:5173") // URL Frontend React
|
policy.WithOrigins(
|
||||||
|
"http://localhost:5173", // Para desarrollo local
|
||||||
|
"http://192.168.4.128:8080" // Para producción
|
||||||
|
)
|
||||||
.AllowAnyHeader()
|
.AllowAnyHeader()
|
||||||
.AllowAnyMethod();
|
.AllowAnyMethod();
|
||||||
// Para pruebas más permisivas (NO USAR EN PRODUCCIÓN):
|
|
||||||
// policy.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
// --- Fin CORS ---
|
// --- Fin CORS ---
|
||||||
|
|||||||
Reference in New Issue
Block a user