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,
|
||||
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) {
|
||||
|
@ -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);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user