@asgardeo/javascript 0.17.0 → 0.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -488,11 +488,14 @@ Message: ${this.message}`;
488
488
  // src/utils/processOpenIDScopes.ts
489
489
  var processOpenIDScopes = (scopes) => {
490
490
  let processedScopes = [];
491
- if (scopes) {
491
+ let userConfiguredScopes = false;
492
+ if (scopes !== void 0 && scopes !== null) {
492
493
  if (Array.isArray(scopes)) {
493
494
  processedScopes = scopes;
495
+ userConfiguredScopes = scopes.length > 0;
494
496
  } else if (typeof scopes === "string") {
495
- processedScopes = scopes.split(" ");
497
+ processedScopes = scopes ? scopes.split(" ") : [];
498
+ userConfiguredScopes = scopes.length > 0;
496
499
  } else {
497
500
  throw new AsgardeoRuntimeError(
498
501
  "Scopes must be a string or an array of strings.",
@@ -502,11 +505,13 @@ var processOpenIDScopes = (scopes) => {
502
505
  );
503
506
  }
504
507
  }
505
- OIDCRequestConstants_default.SignIn.Payload.DEFAULT_SCOPES.forEach((defaultScope) => {
506
- if (!processedScopes.includes(defaultScope)) {
507
- processedScopes.push(defaultScope);
508
- }
509
- });
508
+ if (!userConfiguredScopes) {
509
+ OIDCRequestConstants_default.SignIn.Payload.DEFAULT_SCOPES.forEach((defaultScope) => {
510
+ if (!processedScopes.includes(defaultScope)) {
511
+ processedScopes.push(defaultScope);
512
+ }
513
+ });
514
+ }
510
515
  return processedScopes.join(" ");
511
516
  };
512
517
  var processOpenIDScopes_default = processOpenIDScopes;