I have included the swagger package(Swashbuckle.AspNetCore) for my asp.net core project. The swagger package is of latest 4.0.1 version. I tried to enable the Authorize button in the swagger ui using below code:
// Register the Swagger generator
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new Info { Title = "Sample API", Description = "Swagger Sample API", Version = "v1" });
c.AddSecurityDefinition("Bearer", new ApiKeyScheme { In = "header", Description = "Please Enter Authentication Token", Name = "Authorization", Type = "SampleApiKey" });
c.AddSecurityRequirement(new Dictionary<string, IEnumerable<string>> {
{ "Bearer", Enumerable.Empty<string>() },
});
});
The button can be visible in the swagger ui but when i clicked the button, it shows below error:
Can anyone point me out what's the problem here?