Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.
TypeScript cloud-alternativecollaborationcollaborative-editingdropboxfile-serverfile-sharingfile-storagefile-syncfull-text-searchhomelabnextcloudon-premiseopen-sourceprivacy-firstprivate-cloudrealtimesecureself-hostedstorage-serverwebdav
fix(backend:auth): improve OIDC response error logging
johaven4c04c98c0bc6
diff --git a/backend/src/authentication/providers/oidc/auth-provider-oidc.service.ts b/backend/src/authentication/providers/oidc/auth-provider-oidc.service.tsindex 35d8c630..7b71ed05 100644--- a/backend/src/authentication/providers/oidc/auth-provider-oidc.service.ts+++ b/backend/src/authentication/providers/oidc/auth-provider-oidc.service.ts@@ -182,7 +182,8 @@ export class AuthProviderOIDC implements AuthProvider {this.logger.error({ tag: this.handleCallback.name, msg: `OIDC callback error: ${error.code} - ${error.error_description}` })throw new HttpException(error.error_description, HttpStatus.BAD_REQUEST)} else {- this.logger.error({ tag: this.handleCallback.name, msg: `OIDC callback error: ${error}` })+ const errorMessage = await this.getOIDCErrorMessage(error)+ this.logger.error({ tag: this.handleCallback.name, msg: `OIDC callback error: ${errorMessage}` })throw new HttpException(error.error_description ?? 'OIDC authentication failed',error instanceof HttpException ? error.getStatus() : (error.status ?? HttpStatus.INTERNAL_SERVER_ERROR)@@ -247,7 +248,8 @@ export class AuthProviderOIDC implements AuthProvider {this.logger.log({ tag: this.initializeOIDCClient.name, msg: `OIDC client initialized successfully for issuer: ${this.oidcConfig.issuerUrl}` })return config} catch (error) {- this.logger.error({ tag: this.initializeOIDCClient.name, msg: `OIDC client initialization failed: ${error?.cause || error}` })+ const errorMessage = await this.getOIDCErrorMessage(error)+ this.logger.error({ tag: this.initializeOIDCClient.name, msg: `OIDC client initialization failed: ${errorMessage}` })throw this.mapOIDCInitializationError(error)}}@@ -274,6 +276,19 @@ export class AuthProviderOIDC implements AuthProvider {}}+ private async getOIDCErrorMessage(error: any): Promise<string> {+ const cause = error?.cause+ if (cause instanceof Response) {+ try {+ return await cause.clone().text()+ } catch {+ return `${cause}`+ }+ }++ return `${cause || error}`+ }+private getTokenAuthMethod(tokenEndpointAuthMethod: OAuthTokenEndpoint, clientSecret?: string) {if (!clientSecret) {return None()