Created
January 17, 2026 13:20
-
-
Save TerenceCLZhang/d528e8567a17c1d188efd3b72e1ab4d9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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(options => | |
| { | |
| options.AddSecurityDefinition( | |
| "Bearer", | |
| new OpenApiSecurityScheme | |
| { | |
| In = ParameterLocation.Header, | |
| Description = "Please enter a valid token.", | |
| Name = "Authorization", | |
| Type = SecuritySchemeType.Http, | |
| BearerFormat = "JWT", | |
| Scheme = "Bearer", | |
| } | |
| ); | |
| options.AddSecurityRequirement(document => | |
| new() { [new OpenApiSecuritySchemeReference("Bearer", document)] = [] } | |
| ); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment