title: SwaggerUI with .NetCore 3.0 bearer token authorization
body: <p>I'm trying to add authorization header into SwaggerUI api test. below is my Startup.cs</p>
  <pre><code>public void ConfigureServices(IServiceCollection services)
      {
         
          services.AddControllers();
          services.Configure&lt;ApiBehaviorOptions&gt;(options =&gt;
          {
              options.SuppressModelStateInvalidFilter = true;
          });
  
          services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_3_0);
  
          services.AddSwaggerGen(c =&gt;
          {
              c.SwaggerDoc(&quot;v1&quot;, new OpenApiInfo
              {
                  Version = &quot;v1&quot;,
                  Title = &quot;API&quot;,
                  Description = &quot;QPIN API with ASP.NET Core 3.0&quot;,
                  Contact = new OpenApiContact()
                  {
                      Name = &quot;Tafsir Dadeh Zarrin&quot;,
                      Url = new Uri(&quot;http://www.tdz.co.ir&quot;)
                  }
              });
              var securitySchema = new OpenApiSecurityScheme
              {
                  Description = &quot;JWT Authorization header using the Bearer scheme. Example: \&quot;Authorization: Bearer {token}\&quot;&quot;,
                  Name = &quot;Authorization&quot;,
                  In = ParameterLocation.Header,
                  Type = SecuritySchemeType.ApiKey
              };
              c.AddSecurityDefinition(&quot;Bearer&quot;, securitySchema);
              
              var securityRequirement = new OpenApiSecurityRequirement();
              securityRequirement.Add(securitySchema, new[] { &quot;Bearer&quot; });
              c.AddSecurityRequirement(securityRequirement);
              
          });
      }
  
      
      public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IServiceProvider serviceProvider)
      {
          app.UseCors(&quot;Cors&quot;);
  
  
          if (env.IsDevelopment())
          {
              app.UseDeveloperExceptionPage();
          }
          else
          {
              app.UseHsts();
          }
  
          app.UseHttpsRedirection();
          app.UseMiddleware&lt;ApiResponseMiddleware&gt;();
          app.UseSwagger();
          app.UseSwaggerUI(c =&gt;
          {
              c.SwaggerEndpoint(&quot;/swagger/v1/swagger.json&quot;, &quot;My API V1&quot;);
          });
          app.UseRouting();
  
          app.UseAuthentication();
          app.UseAuthorization();
  
  
          app.UseEndpoints(endpoints =&gt;
          {
              endpoints.MapControllers();
          });
  
      }
  </code></pre>
  <p>The Authorize button has been added to the Swagger UI and I've entered the required access token as shown below</p>
  <p><a href="https://i.stack.imgur.com/zHhb2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zHhb2.png" alt="authorize swaggerUI" /></a></p>
  <p>but the issue is when I want to try an API the token is not getting added into API request, and when I click the lock icon over the API it shows that there isn't any available authorization, see below</p>
  <p><a href="https://i.stack.imgur.com/NaZeX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NaZeX.png" alt="enter image description here" /></a></p>