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];