From 029c0c110b3945701aecae3141fc5ef37ed0d63f Mon Sep 17 00:00:00 2001 From: SWAPAN MANDI <96920652+swapanmandi@users.noreply.github.com> Date: Fri, 20 Sep 2024 19:49:20 +0530 Subject: [PATCH] remove custom token and add uuid generates token --- x-pack/plugins/fleet/server/routes/app/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/fleet/server/routes/app/index.ts b/x-pack/plugins/fleet/server/routes/app/index.ts index 994348f6d9967..714410267ed1b 100644 --- a/x-pack/plugins/fleet/server/routes/app/index.ts +++ b/x-pack/plugins/fleet/server/routes/app/index.ts @@ -7,6 +7,7 @@ import type { RequestHandler, RouteValidationResultFactory } from '@kbn/core/server'; import type { TypeOf } from '@kbn/config-schema'; +import { v4 as uuidv4 } from 'uuid'; import { parseExperimentalConfigValue } from '../../../common/experimental_features'; import type { FleetAuthzRouter } from '../../services/security'; @@ -133,7 +134,7 @@ export const generateServiceTokenHandler: RequestHandler< token?: GenerateServiceTokenResponse; }>({ method: 'POST', - path: `_security/service/elastic/${serviceAccount}/credential/token/token-${Date.now()}`, + path: `_security/service/elastic/${serviceAccount}/credential/token/token-${uuidv4()}`, }); if (tokenResponse.created && tokenResponse.token) {