diff --git a/dist/index.html b/dist/index.html index 02108c2f..aa180158 100644 --- a/dist/index.html +++ b/dist/index.html @@ -63,7 +63,7 @@ log("key: " + key); if(key && key.trim() != "") { log("added key " + key); - window.authorizations.add("key", new ApiKeyAuthorization("api_key", key, "query")); + window.authorizations.add("api_key", new ApiKeyAuthorization("api_key", key, "query")); } } diff --git a/src/main/html/index.html b/src/main/html/index.html index fcca21ce..aa180158 100644 --- a/src/main/html/index.html +++ b/src/main/html/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("api_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(); });