From 8cb7144ff47944bca8bc4ce79f1b933e2ddf016a Mon Sep 17 00:00:00 2001 From: marcos-silva-rodrigues Date: Mon, 14 Jul 2025 15:14:25 -0300 Subject: [PATCH] FIX: send accessToken in refresh token endpoint --- src/modules/auth/auth.controller.ts | 4 ++-- src/modules/auth/auth.service.ts | 4 ++-- src/modules/auth/dtos/login.ts | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/modules/auth/auth.controller.ts b/src/modules/auth/auth.controller.ts index 8d8352e..649adf5 100644 --- a/src/modules/auth/auth.controller.ts +++ b/src/modules/auth/auth.controller.ts @@ -104,7 +104,7 @@ export class AuthController { @Headers('origin') origin: string, ) { this.logger.info('/auth - RefreshAccessToken'); - const { refreshToken, customerName: customer_name } = body; + const { refreshToken, customerName: customer_name, accessToken } = body; const frontHost = origin.replace(/^https?:\/\//, ''); const metadata = PackTheMetadata({ language, @@ -112,7 +112,7 @@ export class AuthController { custom_host: frontHost, }); - return this.authClient.refreshAccessToken({ refreshToken }, metadata); + return this.authClient.refreshAccessToken({ refreshToken, accessToken }, metadata); } @ApiInternalOnlyEndpoint() diff --git a/src/modules/auth/auth.service.ts b/src/modules/auth/auth.service.ts index e8ff70f..38e2a95 100644 --- a/src/modules/auth/auth.service.ts +++ b/src/modules/auth/auth.service.ts @@ -74,13 +74,13 @@ export class AuthClientService implements OnModuleInit { } async refreshAccessToken( - { refreshToken }: AuthRefreshAccessTokenRequest, + { refreshToken, accessToken }: AuthRefreshAccessTokenRequest, metadata: Metadata, ) { this.logger.info('RefreshAccessToken'); return lastValueFrom( - this.authService.AuthRefreshAccessToken({ refreshToken }, metadata), + this.authService.AuthRefreshAccessToken({ refreshToken, accessToken }, metadata), ); } diff --git a/src/modules/auth/dtos/login.ts b/src/modules/auth/dtos/login.ts index 0cd90ae..34807e3 100644 --- a/src/modules/auth/dtos/login.ts +++ b/src/modules/auth/dtos/login.ts @@ -122,6 +122,8 @@ export class AuthRefreshAccessTokenReq { @ApiProperty() refreshToken: string; @ApiProperty() + accessToken: string; + @ApiProperty() customerName: string; } export class AuthRefreshAccessTokenRes {