public void ConfigureServices(IServiceCollection services) { // init codes //.. services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new Info { Title = "BermudaPay API", Version = "v1" }); c.AddSecurityDefinition("BasicAuth", new BasicAuthScheme { Description = "Login" }); c.AddSecurityDefinition("Bearer", new ApiKeyScheme { Description = "JWT Authorization header using the Bearer scheme. Example: \"Authorization: Bearer {token}\"", Name = "Authorization", In = "header", Type = "apiKey" }); var security = new Dictionary> { {"Bearer", new string[] { }}, }; c.AddSecurityRequirement(security); }); } public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseStaticFiles(); app.UseAuthentication(); app.UseCorsMiddleware(); // Enable middleware to serve generated Swagger as a JSON endpoint. app.UseSwagger(); // Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.), // specifying the Swagger JSON endpoint. app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "BermudaPay API V1"); //c.InjectJavascript("/static/js/CustomSwagger.js"); c.IndexStream = () => GetType().Assembly.GetManifestResourceStream("api.Resources.Swagger.index.html"); }); app.UseMvc(); }