fixed to handle scope init option

This commit is contained in:
dcore94 2024-10-18 12:50:06 +02:00
parent b5758dadc4
commit a522a7a1cc
1 changed files with 8 additions and 10 deletions

View File

@ -442,16 +442,14 @@
baseUrl = kc.endpoints.authorize();
}
var scope;
if (options && options.scope || kc.scope) {
if (options.scope.indexOf("openid") != -1) {
scope = options.scope;
} else {
scope = "openid " + options.scope;
}
} else {
scope = "openid";
}
var scope = options && options.scope || kc.scope;
if (!scope) {
// if scope is not set, default to "openid"
scope = "openid";
} else if (scope.indexOf("openid") === -1) {
// if openid scope is missing, prefix the given scopes with it
scope = "openid " + scope;
}
var url = baseUrl
+ '?client_id=' + encodeURIComponent(kc.clientId)