-
Notifications
You must be signed in to change notification settings - Fork 9k
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
How do I customize the authz dialog box to pre-populate the username text box? #4264
Comments
Providing some more info about my struggle with this with the authorize reducer (see code snippet from source below); it seems that the authorize reducer simply assumes a set of credentials if simply a username is present and does not really check if the password has a set value (unless by design this assumes an empty string or null as a valid password value) and renders the logout button on the auth pop up. Is there any way to change the behaviour of this reducer?
|
Hey @gautampriya! Your suspicion is correct - the selector is the wrong tool for the job. Selectors get data from the application state, it sounds like you want to take data you have in local storage and put it into the application state. For that sort of thing, you'd want to use an action, which is a higher level interface that eventually feeds data into a reducer. In terms of giving that data to Swagger-UI, I think what you're really looking for is an interface like the one described in #2915. It's still in progress, but in the meantime there are some workarounds that use internal actions: #2915 (comment) I hope this helps. Closing for now - if there's anything else, or I misunderstood something, just reply! |
Locking due to inactivity. This is done to avoid resurrecting old issues and bumping long threads with new, possibly unrelated content. If you think you're experiencing something similar to what you've found here: please open a new issue, follow the template, and reference this issue in your report. Thanks! |
I am trying to customize the Authorization pop up dialog box in Swagger UI 3 to pre-populate the user name as shown in the picture below.
The application I am working on embeds the swagger ui in an iframe and stores the user name in browser session storage. I have not found a 'reducer' that would help me do this in here and neither have I found any other alternative other than use the authorize 'selector' to return an object like this -
This obviously sets the user name in the box but makes the swagger ui believe that the user is logged in when in reality the user has not really logged in yet.
I am obviously using the wrong tool here aka the selector; but I could not find a reducer that I could work with. While I am still looking around the swagger ui source code for ways to do this correctly, I thought asking the forum may help. Any pointers on the best way to achieve this would be appreciated. FWIW - I am trying to see if using a wrapSelector for the authorized selector would do the trick.
The text was updated successfully, but these errors were encountered: