Skip to content

Commit f13a058

Browse files
committed
Merge pull request swagger-api#1170 from swagger-api/apikeyfix
Add API Key auth in onComplete callback of SwaggerUI#load call
2 parents ff80a29 + 60e9c08 commit f13a058

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

index.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,12 @@
4242
});
4343
*/
4444
}
45+
4546
$('pre code').each(function(i, e) {
4647
hljs.highlightBlock(e)
4748
});
49+
50+
addApiKeyAuthorization();
4851
},
4952
onFailure: function(data) {
5053
log("Unable to Load SwaggerUI");
@@ -53,9 +56,8 @@
5356
sorter : "alpha"
5457
});
5558

56-
function addApiKeyAuthorization() {
59+
function addApiKeyAuthorization(){
5760
var key = encodeURIComponent($('#input_apiKey')[0].value);
58-
log("key: " + key);
5961
if(key && key.trim() != "") {
6062
var apiKeyAuth = new SwaggerClient.ApiKeyAuthorization("api_key", key, "query");
6163
window.swaggerUi.api.clientAuthorizations.add("api_key", apiKeyAuth);

0 commit comments

Comments
 (0)