swagger-api / swagger-api/swagger-ui
Allow to use sessionStorage for persisting authorization
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
Content & configuration
Currently when you use:
SwaggerUI({
persistAuthorization: true,
})
... then the authorization details will be permanently stored in window.localStorage, as per this line of code, surviving browser restarts, etc.
Describe the solution you'd like
I'd love to be able to do:
SwaggerUI({
persistAuthorization: true,
persistAuthorizationInSession: true,
})
... and let it use window.sessionStorage instead, so that i can refresh the page without having to re-authenticate, but wouldn't let the authentication details be available for any page in the same domain, etc.
What do you think?
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
Start with src/core/plugins/auth/actions.js at the linked persistAuthorization logic and trace how the SwaggerUI configuration reaches it. Add the requested sessionStorage option while preserving existing localStorage behavior, then verify that authorization survives a refresh without being persisted across browser restarts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- authentication, frontend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100