Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(proxy): fix proxy header construction for two_step #3314

Merged
merged 4 commits into from
Jan 17, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 27 additions & 39 deletions packages/shared/lib/services/proxy.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
}
}
hassan254-prog marked this conversation as resolved.
Show resolved Hide resolved

const provider = getProvider(providerName);
Expand Down Expand Up @@ -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, '');
Expand Down
Loading