swagger-api / swagger-api/swagger-ui
Authorize header is not sent on json fetch
Nobody has claimed this yet.
- 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:
- Navigate to http://petstore.swagger.io/
- Click Authorize
- Fill in api_key auth method with any token and click Authorize, click close.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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