diff --git a/packages/shared/lib/services/proxy.service.ts b/packages/shared/lib/services/proxy.service.ts index 89bce6bdbe5..844837b96f8 100644 --- a/packages/shared/lib/services/proxy.service.ts +++ b/packages/shared/lib/services/proxy.service.ts @@ -77,52 +77,39 @@ class ProxyService { let token; switch (connection.credentials.type) { case 'OAUTH2': - { - const credentials = connection.credentials; - token = credentials.access_token; - } + case 'APP': { + const credentials = connection.credentials; + token = credentials.access_token; break; - case 'OAUTH1': { - const error = new Error('OAuth1 is not supported yet in the proxy.'); - const nangoError = new NangoError('pass_through_error', error); - return { success: false, error: nangoError, response: null, logs }; } - case 'BASIC': - token = connection.credentials; - break; - case 'API_KEY': - token = connection.credentials; - break; - case 'APP': - { - const credentials = connection.credentials; - token = credentials.access_token; - } - break; case 'OAUTH2_CC': - { - const credentials = connection.credentials; - token = credentials.token; - } - break; + case 'TWO_STEP': case 'TABLEAU': - { - const credentials = connection.credentials; - token = credentials.token; - } - break; case 'JWT': - { - const credentials = connection.credentials; - token = credentials.token; - } + case 'SIGNATURE': { + const credentials = connection.credentials; + token = credentials.token; break; - case 'SIGNATURE': - { - const credentials = connection.credentials; - token = credentials.token; - } + } + case 'BASIC': + case 'API_KEY': + token = connection.credentials; break; + case 'OAUTH1': { + const error = new Error('OAuth1 is not supported yet in the proxy.'); + const nangoError = new NangoError('pass_through_error', error); + return { success: false, error: nangoError, response: null, logs }; + } + case 'APP_STORE': + case 'CUSTOM': + case 'TBA': + case undefined: + case 'BILL': { + break; + } + default: { + throw new Error(`Unhandled connection.credentials for: ${(connection.credentials as any).type}`); + } } const provider = getProvider(providerName); @@ -471,6 +458,7 @@ class ProxyService { case 'API_KEY': case 'OAUTH2_CC': case 'TABLEAU': + case 'TWO_STEP': case 'JWT': if (value.includes('connectionConfig')) { value = value.replace(/connectionConfig\./g, '');