Skip to content

Instantly share code, notes, and snippets.

@VisualBean
Last active December 14, 2015 11:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VisualBean/d5ee54d0ebb79d7474c0 to your computer and use it in GitHub Desktop.
Save VisualBean/d5ee54d0ebb79d7474c0 to your computer and use it in GitHub Desktop.
Basic-Authentication for swaggers index.html
function addBasicAuthorization() {
var username = $('#input_username').val();
var password = $('#input_password').val();
if (username && username.trim() != "" && password && password.trim() != "") {
var basicAuth = new SwaggerClient.PasswordAuthorization('basic', username, password);
window.swaggerUi.api.clientAuthorizations.add("basicAuth", basicAuth);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment