mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
This commit is contained in:
parent
838bc34a4f
commit
42a79b2557
@ -49,6 +49,7 @@ export function handleOauthCallback() {
|
|||||||
code: sentCode,
|
code: sentCode,
|
||||||
amoid,
|
amoid,
|
||||||
redirectUri: location.origin + location.pathname,
|
redirectUri: location.origin + location.pathname,
|
||||||
|
sid,
|
||||||
}).then(authResp => {
|
}).then(authResp => {
|
||||||
const { accessToken, error, errorMessage } = authResp;
|
const { accessToken, error, errorMessage } = authResp;
|
||||||
|
|
||||||
@ -164,18 +165,18 @@ export async function redirectToLogin(config = null, force = false) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.oauth) {
|
// if (config.oauth) {
|
||||||
const state = `dbg-oauth:${Math.random().toString().substr(2)}`;
|
// const state = `dbg-oauth:${Math.random().toString().substr(2)}`;
|
||||||
const scopeParam = config.oauthScope ? `&scope=${config.oauthScope}` : '';
|
// const scopeParam = config.oauthScope ? `&scope=${config.oauthScope}` : '';
|
||||||
sessionStorage.setItem('oauthState', state);
|
// sessionStorage.setItem('oauthState', state);
|
||||||
console.log('Redirecting to OAUTH provider');
|
// console.log('Redirecting to OAUTH provider');
|
||||||
location.replace(
|
// location.replace(
|
||||||
`${config.oauth}?client_id=${config.oauthClient}&response_type=code&redirect_uri=${encodeURIComponent(
|
// `${config.oauth}?client_id=${config.oauthClient}&response_type=code&redirect_uri=${encodeURIComponent(
|
||||||
location.origin + location.pathname
|
// location.origin + location.pathname
|
||||||
)}&state=${encodeURIComponent(state)}${scopeParam}`
|
// )}&state=${encodeURIComponent(state)}${scopeParam}`
|
||||||
);
|
// );
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
export function internalRedirectTo(path) {
|
export function internalRedirectTo(path) {
|
||||||
|
@ -141,6 +141,7 @@ const driver = {
|
|||||||
if (connection.authType != 'msentra') return null;
|
if (connection.authType != 'msentra') return null;
|
||||||
return authProxy.authProxyGetRedirectUrl({
|
return authProxy.authProxyGetRedirectUrl({
|
||||||
...options,
|
...options,
|
||||||
|
client: platformInfo.isElectron ? 'app' : 'web',
|
||||||
type: 'msentra',
|
type: 'msentra',
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -157,7 +158,7 @@ driver.initialize = dbgateEnv => {
|
|||||||
requireMsnodesqlv8 = dbgateEnv.nativeModules.msnodesqlv8;
|
requireMsnodesqlv8 = dbgateEnv.nativeModules.msnodesqlv8;
|
||||||
}
|
}
|
||||||
platformInfo = dbgateEnv.platformInfo;
|
platformInfo = dbgateEnv.platformInfo;
|
||||||
azureAuth = dbgateEnv.azureAuth;
|
authProxy = dbgateEnv.authProxy;
|
||||||
nativeDriver.initialize(dbgateEnv);
|
nativeDriver.initialize(dbgateEnv);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user