@@ -113,6 +113,7 @@ const setOidcAuthEnv = (c: Context, config?: Partial<OidcAuthEnv>) => {
113113 if ( oidcAuthEnv . OIDC_CLIENT_SECRET === undefined ) {
114114 throw new HTTPException ( 500 , { message : 'OIDC client secret is not provided' } )
115115 }
116+ // Allow empty string as valid client secret
116117 oidcAuthEnv . OIDC_REDIRECT_URI = oidcAuthEnv . OIDC_REDIRECT_URI ?? defaultOidcRedirectUri
117118 if ( ! oidcAuthEnv . OIDC_REDIRECT_URI . startsWith ( '/' ) ) {
118119 try {
@@ -167,11 +168,18 @@ export const getClient = (c: Context): oauth2.Client => {
167168 const env = getOidcAuthEnv ( c )
168169 let client = c . get ( 'oidcClient' )
169170 if ( client === undefined ) {
170- client = {
171- client_id : env . OIDC_CLIENT_ID ,
172- client_secret : env . OIDC_CLIENT_SECRET ,
173- token_endpoint_auth_method : 'client_secret_basic' ,
174- }
171+ client =
172+ env . OIDC_CLIENT_SECRET === ''
173+ ? {
174+ // No client secret provided, use 'none' auth method
175+ client_id : env . OIDC_CLIENT_ID ,
176+ token_endpoint_auth_method : 'none' ,
177+ }
178+ : {
179+ client_id : env . OIDC_CLIENT_ID ,
180+ client_secret : env . OIDC_CLIENT_SECRET ,
181+ token_endpoint_auth_method : 'client_secret_basic' ,
182+ }
175183 c . set ( 'oidcClient' , client )
176184 }
177185 return client
0 commit comments