0

I am stuck on something stupid : I want to display the documentation for each route with swagger only if I give a correct api-key. How can I achieve that? Where can I configure the headers when I try to load the UI?

I tried that :

$('#input_apiKey').change(function() {
  var key = $('#input_apiKey')[0].value;
  if(key && key.trim() != "") {
    swaggerUi.api.clientAuthorizations.add("key", new SwaggerClient.ApiKeyAuthorization("api_key", key, "header"));
  }
})

But it doesn't appear in the request headers.

krakig
  • 1,515
  • 1
  • 19
  • 33
  • This might help a bit... http://stackoverflow.com/questions/30350680/how-to-send-authorization-header-with-a-request-in-swagger-ui – Marta May 26 '15 at 10:56
  • 1
    Actually, I just forked again the swagger-ui and wrote the same code : it worked... The mistery of magic – krakig May 26 '15 at 13:09

0 Answers0