I have a swagger API in asp.net. I am using token based authentication in my project. I get the token in response by a post request in tokenendpointpath [/token].Now i need to pass that token automatically with every request curl Authorization header. I tried in many ways but its not working.I don't want the user to every time input that token when request. Please kindly help me to get rid of this issue.
//request for token
//request for resource
//Swagger.config class
public class SwaggerConfig
{
public static void Register()
{
var thisAssembly = typeof(SwaggerConfig).Assembly;
GlobalConfiguration.Configuration
.EnableSwagger(c =>
{
c.DocumentFilter<AuthTokenOperation>();
c.SingleApiVersion("v1", "API");
c.PrettyPrint();
})
.EnableSwaggerUi(c =>
{
c.DocumentTitle("MY API");
});
}
}
Thanx in advance
Update to web api .net framework
.EnableSwagger(c =>
{
c.DocumentFilter<AuthTokenOperation>();
c.SingleApiVersion("v1", "API");
c.PrettyPrint();
c.ApiKey("apiKey")
.Description("API Key for accessing secure APIs")
.Name("Api-Key")
.In("header");
})