This commit is contained in:
P-A
2026-03-29 21:38:02 +02:00
parent bf4adb72eb
commit 7e1e44a4dc
2 changed files with 12 additions and 4 deletions

View File

@@ -30,7 +30,14 @@ builder.Services.AddCors(options =>
// ======================
var jwtSettings = builder.Configuration.GetSection("JwtSettings");
var key = Encoding.UTF8.GetBytes(jwtSettings["Key"]);
string? secretKey = jwtSettings["Key"];
if(string.IsNullOrEmpty(secretKey))
{
return;
}
var key = Encoding.UTF8.GetBytes(secretKey);
// ======================
// Lägg till JWT Authentication
@@ -84,4 +91,4 @@ app.UseAuthorization();
app.MapControllers();
app.Run();
await app.RunAsync();