Skip to content

Commit

Permalink
fix: build
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielRivers committed Mar 13, 2024
1 parent 0220045 commit 882696d
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions lib/sdk/oauth2-flows/AuthCodeAbstract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ export abstract class AuthCodeAbstract {
let scope = this.config.scope ?? AuthCodeAbstract.DEFAULT_TOKEN_SCOPES
scope = scope.split(' ').includes('openid') ? scope : `${scope} openid`;

let searchParamsObject: Record<string, string> = {
let searchParamsObject: Record<string, unknown> = {
scope,
};

Expand All @@ -263,16 +263,26 @@ export abstract class AuthCodeAbstract {
searchParamsObject.is_create_org = 'true';
}

if (options.post_login_redirect_url) {
searchParamsObject.post_login_redirect_url = options.post_login_redirect_url;
}

if (options.authUrlParams) {
searchParamsObject = { ...options.authUrlParams, ...searchParamsObject };
const { lang, login_hint: loginHint, connection_id: connectionId, ...rest } = options.authUrlParams;
searchParamsObject = { ...rest, ...searchParamsObject };

if (lang) {
searchParamsObject.lang = lang;
}

if (loginHint) {
searchParamsObject.login_hint = loginHint;
}

if (connectionId) {
searchParamsObject.connection_id = connectionId;
}
}

for (const key in searchParamsObject)
searchParams.append(key, searchParamsObject[key]);
for (const key in searchParamsObject) {
searchParams.append(key, String(searchParamsObject[key]!));
}

if (this.config.audience) {
const audienceArray = Array.isArray(this.config.audience) ? this.config.audience : [this.config.audience];
Expand Down

0 comments on commit 882696d

Please sign in to comment.