From 42a79b25574f0d8970909326631cc5f3ae4c423d Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Tue, 13 Aug 2024 13:53:14 +0200 Subject: [PATCH] fix --- packages/web/src/clientAuth.ts | 25 ++++++++++--------- .../dbgate-plugin-mssql/src/backend/driver.js | 3 ++- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/packages/web/src/clientAuth.ts b/packages/web/src/clientAuth.ts index dd088ae7..a5fffd7f 100644 --- a/packages/web/src/clientAuth.ts +++ b/packages/web/src/clientAuth.ts @@ -49,6 +49,7 @@ export function handleOauthCallback() { code: sentCode, amoid, redirectUri: location.origin + location.pathname, + sid, }).then(authResp => { const { accessToken, error, errorMessage } = authResp; @@ -164,18 +165,18 @@ export async function redirectToLogin(config = null, force = false) { return; } - if (config.oauth) { - const state = `dbg-oauth:${Math.random().toString().substr(2)}`; - const scopeParam = config.oauthScope ? `&scope=${config.oauthScope}` : ''; - sessionStorage.setItem('oauthState', state); - console.log('Redirecting to OAUTH provider'); - location.replace( - `${config.oauth}?client_id=${config.oauthClient}&response_type=code&redirect_uri=${encodeURIComponent( - location.origin + location.pathname - )}&state=${encodeURIComponent(state)}${scopeParam}` - ); - return; - } + // if (config.oauth) { + // const state = `dbg-oauth:${Math.random().toString().substr(2)}`; + // const scopeParam = config.oauthScope ? `&scope=${config.oauthScope}` : ''; + // sessionStorage.setItem('oauthState', state); + // console.log('Redirecting to OAUTH provider'); + // location.replace( + // `${config.oauth}?client_id=${config.oauthClient}&response_type=code&redirect_uri=${encodeURIComponent( + // location.origin + location.pathname + // )}&state=${encodeURIComponent(state)}${scopeParam}` + // ); + // return; + // } } export function internalRedirectTo(path) { diff --git a/plugins/dbgate-plugin-mssql/src/backend/driver.js b/plugins/dbgate-plugin-mssql/src/backend/driver.js index 0f2ed523..3b8fdfe9 100644 --- a/plugins/dbgate-plugin-mssql/src/backend/driver.js +++ b/plugins/dbgate-plugin-mssql/src/backend/driver.js @@ -141,6 +141,7 @@ const driver = { if (connection.authType != 'msentra') return null; return authProxy.authProxyGetRedirectUrl({ ...options, + client: platformInfo.isElectron ? 'app' : 'web', type: 'msentra', }); }, @@ -157,7 +158,7 @@ driver.initialize = dbgateEnv => { requireMsnodesqlv8 = dbgateEnv.nativeModules.msnodesqlv8; } platformInfo = dbgateEnv.platformInfo; - azureAuth = dbgateEnv.azureAuth; + authProxy = dbgateEnv.authProxy; nativeDriver.initialize(dbgateEnv); };