Added flexible scope separator
This commit is contained in:
@@ -5,6 +5,7 @@ var clientId;
|
|||||||
var realm;
|
var realm;
|
||||||
var oauth2KeyName;
|
var oauth2KeyName;
|
||||||
var redirect_uri;
|
var redirect_uri;
|
||||||
|
var scopeSeparator;
|
||||||
|
|
||||||
function handleLogin() {
|
function handleLogin() {
|
||||||
var scopes = [];
|
var scopes = [];
|
||||||
@@ -151,7 +152,7 @@ function handleLogin() {
|
|||||||
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(scopes.join(' '));
|
url += '&scope=' + encodeURIComponent(scopes.join(scopeSeparator));
|
||||||
url += '&state=' + encodeURIComponent(state);
|
url += '&state=' + encodeURIComponent(state);
|
||||||
|
|
||||||
window.open(url);
|
window.open(url);
|
||||||
@@ -185,6 +186,7 @@ function initOAuth(opts) {
|
|||||||
popupDialog = (o.popupDialog||$('.api-popup-dialog'));
|
popupDialog = (o.popupDialog||$('.api-popup-dialog'));
|
||||||
clientId = (o.clientId||errors.push('missing client id'));
|
clientId = (o.clientId||errors.push('missing client id'));
|
||||||
realm = (o.realm||errors.push('missing realm'));
|
realm = (o.realm||errors.push('missing realm'));
|
||||||
|
scopeSeparator = (o.scopeSeparator||' ');
|
||||||
|
|
||||||
if(errors.length > 0){
|
if(errors.length > 0){
|
||||||
log('auth unable initialize oauth: ' + errors);
|
log('auth unable initialize oauth: ' + errors);
|
||||||
|
|||||||
@@ -38,7 +38,8 @@
|
|||||||
initOAuth({
|
initOAuth({
|
||||||
clientId: "your-client-id",
|
clientId: "your-client-id",
|
||||||
realm: "your-realms",
|
realm: "your-realms",
|
||||||
appName: "your-app-name"
|
appName: "your-app-name",
|
||||||
|
scopeSeparator: ","
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user