can anyone suggest how to add multiple security schemes in Swashbuckle? and declaring both schemes are applicable globally 1. Bearer Token and 2. Apikey
Asked
Active
Viewed 250 times
1 Answers
0
adding the scheme as bearer and custom apikey scheme solved what i needed
c.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
{
Name = "Token",
In = ParameterLocation.Header,
Type = SecuritySchemeType.Http,
Description = "Please enter your token",
Scheme = "bearer"
});
c.AddSecurityDefinition("X-ApiKey", new OpenApiSecurityScheme
{
Name = "X-ApiKey",
In = ParameterLocation.Header,
Type = SecuritySchemeType.ApiKey,
Description = "Please enter your Api Key",
Scheme = "x-apikey"
});
if there is a better approach please post the answer.
and please provide the comments as well when downvote so i would know what the reason.

zeusmos
- 168
- 1
- 4
- 13