The first thing we need to do is go to the Nuget Manager for the solution and search for:
Once we have installed it we need to verify the next lines of code in the ConfigureServices we will need to add the following lines of code into such a method.
// Set up JWT tokenservices.AddAuthentication(JwtBearerDefaults.AuthenticationScheme).AddJwtBearer(options =>{options.TokenValidationParameters=newTokenValidationParameters { ValidateIssuerSigningKey =true, IssuerSigningKey =newSymmetricSecurityKey(Encoding.ASCII .GetBytes(Configuration.GetSection("AppSettings:Token").Value)), ValidateIssuer =false, ValidateAudience =false };});services.AddSwaggerGen(c =>{c.SwaggerDoc("v1",newOpenApiInfo { Title ="Hyreet V1", Version ="v1" });});
In our AppSettings.json we need to add the following lines of code: