From 882696d5458b9e9c548d98bc5f3be8a215c57bfb Mon Sep 17 00:00:00 2001 From: Daniel Rivers Date: Wed, 13 Mar 2024 19:53:12 +0000 Subject: [PATCH] fix: build --- lib/sdk/oauth2-flows/AuthCodeAbstract.ts | 26 ++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/lib/sdk/oauth2-flows/AuthCodeAbstract.ts b/lib/sdk/oauth2-flows/AuthCodeAbstract.ts index 54002d7..386811a 100644 --- a/lib/sdk/oauth2-flows/AuthCodeAbstract.ts +++ b/lib/sdk/oauth2-flows/AuthCodeAbstract.ts @@ -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 = { + let searchParamsObject: Record = { scope, }; @@ -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];