Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to use sessionStorage for persisting authorization #8711

Open
eliasdorneles opened this issue May 24, 2023 · 3 comments
Open

Allow to use sessionStorage for persisting authorization #8711

eliasdorneles opened this issue May 24, 2023 · 3 comments

Comments

@eliasdorneles
Copy link

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?

@sprudel79
Copy link

I would like to get this as well, my basic problem with localStorage is basically that the credentials are kept much longer and the token might have expired already when trying to reuse it again. Using sessionStorage would reduce this behavior sense the auth detailed are not kept longer than the actual session.

@solita-kattelus
Copy link

Was wondering why in our use case api keys was kept when changing api version on toolbar before (old springfox and old swagger ui). But after some version updates (changed to spring doc and same time swagger ui version get updated) this stopped working. I guess it is related to #7046. In our case we would also like to keep apiKeys in use during session or at least until page is refreshed (and this worked originally) because apis we show in toolbar are all related to our same backend but different versions and because of that api key leaking is not problem.

@solita-kattelus
Copy link

Somehow related one #8716

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants