diff --git a/src/v0/destinations/marketo_bulk_upload/util.js b/src/v0/destinations/marketo_bulk_upload/util.js index 9661b0e4cb..84af8ec2d6 100644 --- a/src/v0/destinations/marketo_bulk_upload/util.js +++ b/src/v0/destinations/marketo_bulk_upload/util.js @@ -142,8 +142,8 @@ const getAccessTokenURL = (config) => { // Fetch access token from client id and client secret // DOC: https://developers.marketo.com/rest-api/authentication/ -const getAccessToken = async (config) => - authCache.get(getAccessTokenCacheKey(config), async () => { +const getAccessToken = async (config) => { + const accessToken = await authCache.get(getAccessTokenCacheKey(config), async () => { const url = getAccessTokenURL(config); const { processedResponse: accessTokenResponse } = await handleHttpRequest('get', url, { destType: 'marketo_bulk_upload', @@ -190,6 +190,8 @@ const getAccessToken = async (config) => 400, ); }); + return accessToken; +}; /** * Handles the response of a polling operation.