From 7cd651afce31d68b48ad3e216a1a235b1c05c1d3 Mon Sep 17 00:00:00 2001 From: ntamotsu Date: Tue, 19 Nov 2024 18:12:20 +0900 Subject: [PATCH] fix: improve client_secret validation in TokenClient --- src/TokenClient.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/TokenClient.ts b/src/TokenClient.ts index 43cb26c9..e49189af 100644 --- a/src/TokenClient.ts +++ b/src/TokenClient.ts @@ -112,7 +112,7 @@ export class TokenClient { let basicAuth: string | undefined; switch (this._settings.client_authentication) { case "client_secret_basic": - if (!client_secret) { + if (client_secret === undefined || client_secret === null) { logger.throw(new Error("A client_secret is required")); throw null; // https://github.com/microsoft/TypeScript/issues/46972 } @@ -173,7 +173,7 @@ export class TokenClient { let basicAuth: string | undefined; switch (this._settings.client_authentication) { case "client_secret_basic": - if (!client_secret) { + if (client_secret === undefined || client_secret === null) { logger.throw(new Error("A client_secret is required")); throw null; // https://github.com/microsoft/TypeScript/issues/46972 } @@ -229,7 +229,7 @@ export class TokenClient { let basicAuth: string | undefined; switch (this._settings.client_authentication) { case "client_secret_basic": - if (!client_secret) { + if (client_secret === undefined || client_secret === null) { logger.throw(new Error("A client_secret is required")); throw null; // https://github.com/microsoft/TypeScript/issues/46972 }