Skip to content

Commit 651c29c

Browse files
committed
an attempt to fix old auth behavior
1 parent 576c7bc commit 651c29c

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

packages/cubejs-databricks-jdbc-driver/src/DatabricksDriver.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,8 @@ export class DatabricksDriver extends JDBCDriver {
213213
url = url.replace('jdbc:spark://', 'jdbc:databricks://');
214214
}
215215

216-
const [uid, pwd, cleanedUrl] = extractAndRemoveUidPwdFromJdbcUrl(url);
216+
// eslint-disable-next-line prefer-const
217+
let [uid, pwd, cleanedUrl] = extractAndRemoveUidPwdFromJdbcUrl(url);
217218
const passwd = conf?.token ||
218219
getEnv('databricksToken', { dataSource }) ||
219220
pwd;
@@ -236,6 +237,7 @@ export class DatabricksDriver extends JDBCDriver {
236237
// For magic numbers below - see Databricks docs:
237238
// https://docs.databricks.com/aws/en/integrations/jdbc-oss/configure#authenticate-the-driver
238239
if (oauthClientId) {
240+
cleanedUrl = cleanedUrl.replace(/;?AuthMech=[^;]*/i, '');
239241
authProps = {
240242
OAuth2ClientID: oauthClientId,
241243
OAuth2Secret: oauthClientSecret,
@@ -244,9 +246,8 @@ export class DatabricksDriver extends JDBCDriver {
244246
};
245247
} else {
246248
authProps = {
247-
user,
249+
UID: user,
248250
PWD: passwd,
249-
AuthMech: 3,
250251
};
251252
}
252253

packages/cubejs-databricks-jdbc-driver/src/helpers.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ export function extractAndRemoveUidPwdFromJdbcUrl(jdbcUrl: string): [uid: string
4848

4949
const cleanedUrl = jdbcUrl
5050
.replace(/;?UID=[^;]*/i, '')
51-
.replace(/;?PWD=[^;]*/i, '')
52-
.replace(/;?AuthMech=[^;]*/i, '');
51+
.replace(/;?PWD=[^;]*/i, '');
5352

5453
return [uid, pwd, cleanedUrl];
5554
}

0 commit comments

Comments
 (0)