Install the package with NuGet:
dotnet add package uBeac.Web.Jwt
Just put the following code in Program.cs:
builder.Services.AddJwtAuthentication(builder.Configuration);
app.UseAuthentication();And in appsettings.json:
{
"Jwt": {
"Issuer": "https://localhost:44352",
"Audience": "https://localhost:44352",
"TokenExpiry": 3600, // seconds
"RefreshTokenExpiry": 36000, // seconds
"Secret": "THIS SHOULD BE A COMPLEX SECRET!"
}
}