Created
May 31, 2016 08:12
-
-
Save mvantellingen/daeb4755402d878525e57c631946d018 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
$(function () { | |
var jwtUI = | |
'<div class="input"><input placeholder="JWT Token" id="input_jwt" name="jwt" type="text" size="20"></div>'; | |
$(jwtUI).insertBefore('#api_selector div.input:last-child'); | |
$("#input_apiKey").hide(); | |
$('#input_jwt').change(addAuthorization); | |
}); | |
function addAuthorization() { | |
var token = $('#input_jwt').val(); | |
if (token && token.trim() != "") { | |
var apiKeyAuth = new SwaggerClient.ApiKeyAuthorization( "Authorization", "Bearer " + token, "header" ); | |
window.swaggerUi.api.clientAuthorizations.add( "Bearer", apiKeyAuth ); | |
console.log("JWT authorization added: " + token); | |
} | |
} | |
})(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment