Fix pasaje de JWT Token por Secret.
All checks were successful
Build and Deploy / remote-build-and-deploy (push) Successful in 17m27s
All checks were successful
Build and Deploy / remote-build-and-deploy (push) Successful in 17m27s
This commit is contained in:
@@ -95,7 +95,11 @@ 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 = builder.Configuration["JWT_KEY"] ?? jwtSettings["Key"] ?? throw new ArgumentNullException("Jwt:Key", "JWT Key not configured");
|
|
||||||
|
// Le decimos que busque la clave JWT en la raíz de la configuración (donde están las variables de entorno).
|
||||||
|
// Si no la encuentra, como respaldo, busca en la sección "Jwt" del appsettings.
|
||||||
|
var jwtKey = builder.Configuration["JWT_KEY"] ?? jwtSettings["Key"] ?? throw new ArgumentNullException("JWT_KEY or Jwt:Key not configured");
|
||||||
|
|
||||||
var keyBytes = Encoding.ASCII.GetBytes(jwtKey);
|
var keyBytes = Encoding.ASCII.GetBytes(jwtKey);
|
||||||
|
|
||||||
builder.Services.AddAuthentication(options =>
|
builder.Services.AddAuthentication(options =>
|
||||||
|
|||||||
Reference in New Issue
Block a user