Created
November 14, 2024 01:08
-
-
Save kevinah95/355384c2b351baa517507a5bdd7bac16 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
builder.Services.AddSwaggerGen(opt => | |
{ | |
opt.SwaggerDoc("v1", new OpenApiInfo { Title = "MyAPI", Version = "v1" }); | |
opt.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme | |
{ | |
In = ParameterLocation.Header, | |
Description = "Please enter token", | |
Name = "Authorization", | |
Type = SecuritySchemeType.Http, | |
BearerFormat = "JWT", | |
Scheme = "bearer" | |
}); | |
opt.AddSecurityRequirement(new OpenApiSecurityRequirement | |
{ | |
{ | |
new OpenApiSecurityScheme | |
{ | |
Reference = new OpenApiReference | |
{ | |
Type=ReferenceType.SecurityScheme, | |
Id="Bearer" | |
} | |
}, | |
new string[]{} | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment