Skip to content

Commit 379609b

Browse files
committed
Added flexible scope separator
1 parent d75505f commit 379609b

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

lib/swagger-oauth.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ var clientId;
55
var realm;
66
var oauth2KeyName;
77
var redirect_uri;
8+
var scopeSeparator;
89

910
function handleLogin() {
1011
var scopes = [];
@@ -151,7 +152,7 @@ function handleLogin() {
151152
url += '&redirect_uri=' + encodeURIComponent(redirectUrl);
152153
url += '&realm=' + encodeURIComponent(realm);
153154
url += '&client_id=' + encodeURIComponent(clientId);
154-
url += '&scope=' + encodeURIComponent(scopes.join(' '));
155+
url += '&scope=' + encodeURIComponent(scopes.join(scopeSeparator));
155156
url += '&state=' + encodeURIComponent(state);
156157

157158
window.open(url);
@@ -185,6 +186,7 @@ function initOAuth(opts) {
185186
popupDialog = (o.popupDialog||$('.api-popup-dialog'));
186187
clientId = (o.clientId||errors.push('missing client id'));
187188
realm = (o.realm||errors.push('missing realm'));
189+
scopeSeparator = (o.scopeSeparator||' ');
188190

189191
if(errors.length > 0){
190192
log('auth unable initialize oauth: ' + errors);

src/main/html/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
initOAuth({
3939
clientId: "your-client-id",
4040
realm: "your-realms",
41-
appName: "your-app-name"
41+
appName: "your-app-name",
42+
scopeSeparator: ","
4243
});
4344
}
4445

0 commit comments

Comments
 (0)