From fe598ff713dd861a6c524550532bbfcb487a8617 Mon Sep 17 00:00:00 2001 From: Matt Aitken Date: Sun, 19 Feb 2023 19:17:41 +0000 Subject: [PATCH] Add support for api_key authentication --- .../src/core/authentication/credentials.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/integrations/src/core/authentication/credentials.ts b/apps/integrations/src/core/authentication/credentials.ts index 460916505..268d835b3 100644 --- a/apps/integrations/src/core/authentication/credentials.ts +++ b/apps/integrations/src/core/authentication/credentials.ts @@ -45,7 +45,16 @@ export function applyCredentials( case "api_key": { const authConfig = authentication[credentials.name]; if (authConfig.placement.in === "header") { - fetch.headers[authConfig.placement.key] = credentials.api_key; + let value = ""; + switch (authConfig.placement.type) { + case "basic": + value = `Basic ${credentials.api_key}`; + break; + case "bearer": + value = `Bearer ${credentials.api_key}`; + break; + } + fetch.headers[authConfig.placement.key] = value; } return fetch; }