swagger-api / swagger-api/swagger-ui

Authorization header not included in UI docs when using securitySchemes

Open
#5,461 3 comments 15 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

Q&A (please complete the following information)
  • OS: macOS
  • Browser: Chrome
  • Version: 75.0.3770.100
  • Method of installation: accessed via SwaggerHub
  • Swagger-UI version: unknown
  • Swagger/OpenAPI version: 3.0.0
Content & configuration

Example Swagger/OpenAPI definition:

openapi: 3.0.0
info:
  version: '1.0.0'
  title: ''
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
security:
  - bearerAuth: []
paths:
  /logout:
    summary: Log out request endpoint
    post:
      responses:
        '200':
          description: 
            'OK'
Describe the bug you're encountering
To reproduce...

Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error
Expected behavior

I was hoping that the use of securitySchemes above would still show that an Authorization header is required for all requests to which scheme: bearer is applied. Unfortunately this is not the case on SwaggerHub (which I assume uses SwaggerUI, but please correct me if not), where I see a padlock button that can be used to configure the auth header but no explicit textual representation.

Screenshots

Here's what I see:

Screen Shot 2019-07-12 at 2 27 55 PM

Here's what I'd want to see - output as if I'd manually defined the header on each request manually, using something like:

      parameters:
        - in: header
          name: Authorization
          schema:
            type: string
          description: The JWT token
          required: true
Screen Shot 2019-07-12 at 2 33 07 PM

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by loading the supplied OpenAPI 3.0 example in Swagger UI or SwaggerHub and compare the displayed operation details with the expected Authorization header representation. Done means bearer security requirements are explicitly represented in the UI for affected requests, rather than only through the padlock control.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, openapi
Domain
documentation, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.