Send bearer token in Swagger using Swagger-Net

Viewed 2037

I have recently made the transition from Swashbuckle to Swagger-Net. One problem that I'm having after making the change is that now I'm unable to call my APIs which require a token sent in the Authorization header. Below are how I had the code in SwaggerConfig.cs before in Swashbuckle and now Swagger-Net

Swashbuckle

//section for .EnableSwagger
c.ApiKey("apiKey")
.Description("API Key Authentication")
.Name("Authorization")
.In("header");

//section for .EnableSwaggerUI
c.EnableApiKeySupport("Authorization", "header");

Swagger-Net

//section for .EnableSwagger
c.ApiKey("Authorization", "header", "API Key Authentication");

For Swagger-Net I can't find any equivalent of the .EnableAPIKeySupport in the .EnableSwaggerUI portion. After accessing the /Swagger UI rendering and using Authorize passing my token it is not sending that token to the API. I can tell it's not being sent as it is not in the sample CURL given.

1 Answers
Related