Conflict SwaggerUi authorizations with Basic Auth to make requests
Hi,
I found a conflict where swaggerui.authorizations overwrites basic auth to make call to API.
For an example, I need to have an authorization to access /api-docs and I put this Authorization on index.html
authorizations: {
fun: new SwaggerClient.ApiKeyAuthorization("Authorization", 'Basic c3dhZ2dlcjpTSXVUaE9lWW9Vcm...', "header")
},
Fine, SwaggerUi is able to get api-docs.json. Now, I want to register my Basic Authentication to make calls on API. When I click on Authorize and try to login with basic auth, all my requests send old authorization (auth proved by swaggerUi) instead of using auth proved by myself.
There is a way that I can force SwaggerUi to clear the authorizations after to download api-docs.json?
yes, in your operations, just create another key name. So you have "fun" for authorizing the /api-docs, but you can assign a requirement for on each operation to use a different auth scheme, other than fun.
Thanks @fehguy, I tried to find something about assign a requirement for each operation to use a different auth, but I didn't find something that could help me. May you show an example?
Logout click isn't working here. I'm using last version.
Take a look at the specification here:
https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md
You simply define a security attribute on each operation, with the corresponding name of the securityDefinition.