updated oauth2 support into a single config

This commit is contained in:
Tony Tam
2014-03-20 15:38:30 -07:00
parent 2edd7ac058
commit 96c14e43a9
6 changed files with 99 additions and 35 deletions

View File

@@ -17,12 +17,10 @@
<script src='swagger-ui.js' type='text/javascript'></script>
<script src='lib/highlight.7.3.pack.js' type='text/javascript'></script>
<!--script src='lib/swagger-oauth.js' type='text/javascript'></script-->
<!-- enabling this will enable oauth2 implicit scope support -->
<script src='lib/swagger-oauth.js' type='text/javascript'></script>
<script type="text/javascript">
// var clientId = "your-client-id";
// var realm = "your-realm";
$(function () {
window.swaggerUi = new SwaggerUi({
url: "http://petstore.swagger.wordnik.com/api/api-docs",
@@ -30,10 +28,19 @@
supportedSubmitMethods: ['get', 'post', 'put', 'delete'],
onComplete: function(swaggerApi, swaggerUi){
log("Loaded SwaggerUI");
/*if(typeof initOAuth == "function")
initOAuth();
*/
$('pre code').each(function(i, e) {hljs.highlightBlock(e)});
if(typeof initOAuth == "function") {
/*
initOAuth({
clientId: "your-client-id",
realm: "your-realms",
appName: "your-app-name"
});
*/
}
$('pre code').each(function(i, e) {
hljs.highlightBlock(e)
});
},
onFailure: function(data) {
log("Unable to Load SwaggerUI");
@@ -51,7 +58,6 @@
})
window.swaggerUi.load();
});
</script>
</head>
@@ -59,7 +65,6 @@
<div id='header'>
<div class="swagger-ui-wrap">
<a id="logo" href="http://swagger.wordnik.com">swagger</a>
<form id='api_selector'>
<div class='input icon-btn'>
<img id="show-pet-store-icon" src="images/pet_store_api.png" title="Show Swagger Petstore Example Apis">
@@ -75,7 +80,6 @@
</div>
<div id="message-bar" class="swagger-ui-wrap">&nbsp;</div>
<div id="swagger-ui-container" class="swagger-ui-wrap"></div>
</body>
</html>