updated key name

This commit is contained in:
Tony Tam
2014-08-01 17:11:59 -07:00
parent 26db2ce375
commit c3904c54c8

View File

@@ -48,7 +48,7 @@ function handleLogin() {
str += '</label></li>'; str += '</label></li>';
popup.append(str); popup.append(str);
} }
}
var $win = $(window), var $win = $(window),
dw = $win.width(), dw = $win.width(),
@@ -73,9 +73,8 @@ function handleLogin() {
popupDialog.hide(); popupDialog.hide();
var authSchemes = window.swaggerUi.api.authSchemes; var authSchemes = window.swaggerUi.api.authSchemes;
var location = window.location; var host = window.location;
var locationUrl = location.protocol + '//' + location.host + location.pathname; var redirectUrl = host.protocol + '//' + host.host + "/o2c.html";
var redirectUrl = locationUrl.replace("index.html","").concat("/o2c.html").replace("//o2c.html","/o2c.html");
var url = null; var url = null;
var p = window.swaggerUi.api.authSchemes; var p = window.swaggerUi.api.authSchemes;
@@ -91,29 +90,23 @@ function handleLogin() {
} }
} }
} }
var scopes = []; var scopes = []
var scopeForUrl='';
var o = $('.api-popup-scopes').find('input:checked'); var o = $('.api-popup-scopes').find('input:checked');
for(var k =0; k < o.length; k++) { for(k =0; k < o.length; k++) {
scopes.push($(o[k]).attr("scope")); scopes.push($(o[k]).attr("scope"));
if(k > 0){
scopeForUrl+=' ';
}
scopeForUrl+=$(o[k]).attr("scope");
} }
window.enabledScopes=scopes; window.enabledScopes=scopes;
url += '&redirect_uri=' + encodeURIComponent(redirectUrl); url += '&redirect_uri=' + encodeURIComponent(redirectUrl);
url += '&realm=' + encodeURIComponent(realm); url += '&realm=' + encodeURIComponent(realm);
url += '&client_id=' + encodeURIComponent(clientId); url += '&client_id=' + encodeURIComponent(clientId);
url += '&scope=' + encodeURIComponent(scopeForUrl); url += '&scope=' + encodeURIComponent(scopes);
window.open(url); window.open(url);
}); });
}
popupMask.show(); popupMask.show();
popupDialog.show(); popupDialog.show();
return; return;
@@ -211,7 +204,7 @@ function onOAuthComplete(token) {
} }
}); });
window.authorizations.add("key", new ApiKeyAuthorization("Authorization", "Bearer " + b, "header")); window.authorizations.add("oauth2", new ApiKeyAuthorization("Authorization", "Bearer " + b, "header"));
} }
} }
} }