Skip to content

Commit f365e1e

Browse files
committed
fix(sso): use nullish coalescing and add env var for tokenEndpointAuthentication
- Use ?? instead of || for semantic correctness - Add SSO_OIDC_TOKEN_ENDPOINT_AUTH env var so users can explicitly set client_secret_basic when their provider requires it
1 parent 4ba09f4 commit f365e1e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/db/scripts/register-sso-provider.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,10 @@ function buildSSOConfigFromEnv(): SSOProviderConfig | null {
215215
pkce: process.env.SSO_OIDC_PKCE !== 'false',
216216
authorizationEndpoint: process.env.SSO_OIDC_AUTHORIZATION_ENDPOINT,
217217
tokenEndpoint: process.env.SSO_OIDC_TOKEN_ENDPOINT,
218+
tokenEndpointAuthentication: process.env.SSO_OIDC_TOKEN_ENDPOINT_AUTH as
219+
| 'client_secret_post'
220+
| 'client_secret_basic'
221+
| undefined,
218222
userInfoEndpoint: process.env.SSO_OIDC_USERINFO_ENDPOINT,
219223
jwksEndpoint: process.env.SSO_OIDC_JWKS_ENDPOINT,
220224
discoveryEndpoint:
@@ -511,7 +515,7 @@ async function registerSSOProvider(): Promise<boolean> {
511515
// credentials without URL-encoding per RFC 6749 §2.3.1, so '+' in secrets
512516
// is decoded as space by OIDC providers, causing invalid_client errors.
513517
tokenEndpointAuthentication:
514-
ssoConfig.oidcConfig.tokenEndpointAuthentication || 'client_secret_post',
518+
ssoConfig.oidcConfig.tokenEndpointAuthentication ?? 'client_secret_post',
515519
jwksEndpoint: ssoConfig.oidcConfig.jwksEndpoint,
516520
pkce: ssoConfig.oidcConfig.pkce,
517521
discoveryEndpoint:

0 commit comments

Comments
 (0)