swagger-api / swagger-api/swagger-ui

Authorize header is not sent on json fetch

Open
#4,325 6 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Swagger-ui version 3.12.1.
Issue is related to 4324 bug.

I need to show/hide some endpoints based on the authorization. To make it work, I need to pass Authorization header when swagger.json request is made, so I can return json based on user roles.

Steps to reproduce:

  1. Navigate to http://petstore.swagger.io/
  2. Click Authorize
  3. Fill in api_key auth method with any token and click Authorize, click close.
  4. Click on Explore button

Expect: swagger-ui should fetch swagger.json with Authorization header and the header value entered from popup input.
Actual: no Authorization header is presented

Should it be done via plugins or requestInterceptors?

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

Reproduce the authorization and Explore steps against the Swagger UI, then inspect the JSON fetch path and the plugin or requestInterceptors entry points mentioned in the issue. Done means the swagger.json request includes the Authorization value entered in the authorization popup and the returned JSON can vary by user roles.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.