From dbb1c42c479f7c9d388eed98c78829039d5fd8da Mon Sep 17 00:00:00 2001 From: Faruk AYDIN Date: Fri, 29 Sep 2023 11:43:45 +0200 Subject: [PATCH] fix(pipedrive): Skip adding auth header for refresh token --- packages/backend/src/apps/pipedrive/auth/refresh-token.ts | 3 +++ packages/backend/src/apps/pipedrive/common/add-auth-header.ts | 3 +++ 2 files changed, 6 insertions(+) diff --git a/packages/backend/src/apps/pipedrive/auth/refresh-token.ts b/packages/backend/src/apps/pipedrive/auth/refresh-token.ts index 42994e38..4be1185d 100644 --- a/packages/backend/src/apps/pipedrive/auth/refresh-token.ts +++ b/packages/backend/src/apps/pipedrive/auth/refresh-token.ts @@ -19,6 +19,9 @@ const refreshToken = async ($: IGlobalVariable) => { params.toString(), { headers, + additionalProperties: { + skipAddingAuthHeader: true, + }, } ); diff --git a/packages/backend/src/apps/pipedrive/common/add-auth-header.ts b/packages/backend/src/apps/pipedrive/common/add-auth-header.ts index 8e7798b8..d15b043e 100644 --- a/packages/backend/src/apps/pipedrive/common/add-auth-header.ts +++ b/packages/backend/src/apps/pipedrive/common/add-auth-header.ts @@ -1,6 +1,9 @@ import { TBeforeRequest } from '@automatisch/types'; const addAuthHeader: TBeforeRequest = ($, requestConfig) => { + if (requestConfig.additionalProperties?.skipAddingAuthHeader) + return requestConfig; + if ($.auth.data?.accessToken) { requestConfig.headers.Authorization = `${$.auth.data.tokenType} ${$.auth.data.accessToken}`; }