function addApiKeyAuthorization(){ var key = encodeURIComponent($('#input_apiKey')[0].value); if(key && key.trim() != "") { var apiKeyAuth = new SwaggerClient.ApiKeyAuthorization("Authorization", "Bearer " + key, "header"); window.swaggerUi.api.clientAuthorizations.add("key", apiKeyAuth); log("added key " + key); } }
Instead of adding api_key as part of the query, this code is adding your token in an "Authorization" header and with "Bearer " as prefix.
enjoy
Aucun commentaire:
Enregistrer un commentaire