From 2fced78075ea928e8e96cf7b303951574c18eb2c Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Mon, 26 Oct 2015 17:11:10 -0700 Subject: [PATCH] rebuilt --- dist/index.html | 2 +- dist/lib/swagger-oauth.js | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/dist/index.html b/dist/index.html index 3e47f2b8..7442d3f1 100644 --- a/dist/index.html +++ b/dist/index.html @@ -48,7 +48,7 @@ if(typeof initOAuth == "function") { initOAuth({ clientId: "your-client-id", - clientSecret: "your-client-secret", + clientSecret: "your-client-secret-if-required", realm: "your-realms", appName: "your-app-name", scopeSeparator: "," diff --git a/dist/lib/swagger-oauth.js b/dist/lib/swagger-oauth.js index 3bb1c277..b04a45cb 100644 --- a/dist/lib/swagger-oauth.js +++ b/dist/lib/swagger-oauth.js @@ -187,7 +187,7 @@ function initOAuth(opts) { popupMask = (o.popupMask||$('#api-common-mask')); popupDialog = (o.popupDialog||$('.api-popup-dialog')); clientId = (o.clientId||errors.push('missing client id')); - clientSecret = (o.clientSecret||errors.push('missing client secret')); + clientSecret = (o.clientSecret||null); realm = (o.realm||errors.push('missing realm')); scopeSeparator = (o.scopeSeparator||' '); @@ -211,11 +211,15 @@ function initOAuth(opts) { window.processOAuthCode = function processOAuthCode(data) { var params = { 'client_id': clientId, - 'client_secret': clientSecret, 'code': data.code, 'grant_type': 'authorization_code', 'redirect_uri': redirect_uri + }; + + if (clientSecret) { + params.client_secret = clientSecret; } + $.ajax( { url : window.swaggerUi.tokenUrl, @@ -230,7 +234,7 @@ window.processOAuthCode = function processOAuthCode(data) { onOAuthComplete(""); } }); -} +}; window.onOAuthComplete = function onOAuthComplete(token) { if(token) { @@ -287,4 +291,4 @@ window.onOAuthComplete = function onOAuthComplete(token) { } } } -} +};