title: Swagger Bearer Authorization not usable in ui
body: <p>I am using openApi 3.0 specification, koa2-swagger-ui, and swagger-jsdoc. I am trying to get the Authorize button on the swagger ui to allow me to enter a JWT token so my requests will be authorized.</p>
  
  <p>I followed the OpenApi 3.0 documentation for setting up the bearerAuth in the securitySchemes and also used security to make it global. All this was implemented in my swagger-config.yaml. </p>
  
  <p>What I want is to be able to click authorize on the swagger ui and have the option to enter a JWT. Currently when I click authorize the box is empty.
  <a href="https://i.stack.imgur.com/R9kHz.png" rel="nofollow noreferrer">empty authorization</a> <a href="https://i.stack.imgur.com/5YP1o.png" rel="nofollow noreferrer">request response 401</a> <a href="https://i.stack.imgur.com/W9nqJ.png" rel="nofollow noreferrer">swagger ui</a> </p>
  
  <p>Swagger.json</p>
  
  <pre><code>    {
    "openapi": "3.0.0",
    "info": {
      "title": "LMS API Specification",
      "version": "1.0.0",
      "description": "Open documentation for LMS API"
    },
    "host": "localhost:8091",
    "basePath": "/",
    "components": {
      "securitySchemes": {
        "bearerAuth": {
          "type": "http",
          "scheme": "bearer",
          "bearerFormat": "JWT"
        }
      }
    },
    "security": [
      {
        "bearerAuth": []
      }
    ],
    "paths": {
      "/instructor/me": {
        "get": {
          "tags": [
            "Instructor"
          ],
          "description": "Finds all classes and their status for the current user",
          "responses": {
            "200": {
              "description": "You have successfully found all classes and their status for the current user"
            }
          }
        }
      }
    },
    "tags": []
  }
  </code></pre>
  
  <p>swagger-config.yaml</p>
  
  <pre><code>openapi: 3.0.0
  info:
    title: LMS API Specification
    version: 1.0.0
    description: Open documentation for LMS API
  host: localhost:8091
  basePath: /
  apis: ['api/v1/instructor/index.js']
  components:
    securitySchemes:
      bearerAuth:
        type: http
        scheme: bearer
        bearerFormat: JWT
  security:
    - bearerAuth: []
  </code></pre>
  
  <p>app.js</p>
  
  <pre><code>import Koa from 'koa'
  import cors from 'koa-cors'
  import serveStatic from 'koa-static'
  // import websockify from 'koa-websocket'
  
  import Logger from './lib/Logger'
  import authInit from './auth'
  
  import index from './routes/index'
  import auth from './routes/auth'
  import launch from './routes/launch'
  import lesson from './routes/lesson'
  import v1 from './api/v1'
  import Router from 'koa-router'
  
  export default async port =&gt; {
    const koaSwagger = require('koa2-swagger-ui');
    // const app = websockify(new Koa
    const app = new Koa()
    const swaggerJSDoc = require('swagger-jsdoc');
    var router = new Router()
    await authInit(app)
  
    // Definitions for the swagger docs
    const swaggerDefinition = {
      info: {
        // API informations (required)
        title: 'LMS API Specification', // Title (required)
        version: '1.0.0', // Version (required)
        description: 'OpenAPI documentation for LMS', // Description (optional)
      },
      host: `localhost:8091/api/v1`, // Host (optional)
      basePath: '/', // Base path (optional)
    };
    const options = {
      // Import swaggerDefinitions
      swaggerDefinition,
      // Path to the API docs
      // Note that this path is relative to the current directory from which the Node.js is ran, not the application itself.
      apis: ['api/v1/instructor/index.js'],
    };
    // Initialize swagger-jsdoc -&gt; returns validated swagger spec in json format
    const swaggerSpec = swaggerJSDoc(options);
    router.get('/swagger.json', async (ctx, next) =&gt; {
  
      ctx.set('Content-Type', 'application/json')
      ctx.body = (swaggerSpec);
      return
    });
    app.use(
      koaSwagger({
        swaggerOptions: {
          url: 'http://localhost:8091/swagger.json', // example path to json
  
        },
        hideTopbar: true,
        routePrefix: '/docs', // route where the view is returned
      }),
    );
  
    Logger.info(`Running in ${process.env.NODE_ENV} environment`)
  
    app
      .use(cors())
      .use(serveStatic(__dirname + '/assets'))
      .use(index.routes())
      .use(auth.routes())
      .use(launch.routes())
      .use(lesson.routes())
      .use(v1.routes())
      .use(router.routes())
  
    return app.listen(port, () =&gt; {
      Logger.info(`&gt; Ready on port ${port}`)
    })
  }
  </code></pre>