diff --git a/index.html b/index.html index fcca21ceea3..02108c2f313 100644 --- a/index.html +++ b/index.html @@ -58,14 +58,26 @@ sorter : "alpha" }); + function addApiKeyAuthorization() { + var key = $('#input_apiKey')[0].value; + log("key: " + key); + if(key && key.trim() != "") { + log("added key " + key); + window.authorizations.add("key", new ApiKeyAuthorization("api_key", key, "query")); + } + } + $('#input_apiKey').change(function() { - var key = $('#input_apiKey')[0].value; - log("key: " + key); - if(key && key.trim() != "") { - log("added key " + key); - window.authorizations.add("key", new ApiKeyAuthorization("api_key", key, "query")); - } - }) + addApiKeyAuthorization(); + }); + + // if you have an apiKey you would like to pre-populate on the page for demonstration purposes... + /* + var apiKey = "myApiKeyXXXX123456789"; + $('#input_apiKey').val(apiKey); + addApiKeyAuthorization(); + */ + window.swaggerUi.load(); });