Closed kyeotic closed 8 years ago
The security token that you add needs to match the name in your securityDefinitions
. So instead of this:
var key = new SwaggerClient.ApiKeyAuthorization("Authorization", 'Bearer ' + auth, "header")
swaggerUi.api.clientAuthorizations.add("key", key)
consider something like this:
var key = new SwaggerClient.ApiKeyAuthorization("Authorization", 'Bearer ' + auth, "header")
swaggerUi.api.clientAuthorizations.add("JwtCustom", key)
Ah! That does it. You might want to note this relationship in the README, it is not very obvious
I am using Swagger UI @version v2.1.4
I am adding an authorization header with the following, inside the load
onComplete
handlerThe result is that "Try it out" operations that do not contain a
Security
definition get the Authorization header added, and resources that do contain aSecurity
definition do not get the Authorization header. This is exactly the opposite of the behavior I expect. Am I doing something wrong, or is this a bug?My Swagger spec is quite large, but here is a relevant slice. The
/apis
resource gets an authorization header, the/users
resource does not.