diff --git a/packages/api/src/controllers/config.js b/packages/api/src/controllers/config.js index 500f61423..5289c8dcf 100644 --- a/packages/api/src/controllers/config.js +++ b/packages/api/src/controllers/config.js @@ -47,6 +47,7 @@ module.exports = { permissions, login, oauth: process.env.OAUTH_AUTH, + oauthClient: process.env.OAUTH_CLIENT_ID, oauthLogout: process.env.OAUTH_LOGOUT, isLoginForm: !!process.env.AD_URL || (!!logins && !process.env.BASIC_AUTH), ...currentVersion, diff --git a/packages/web/src/clientAuth.ts b/packages/web/src/clientAuth.ts index 8d72a697a..58b655e7b 100644 --- a/packages/web/src/clientAuth.ts +++ b/packages/web/src/clientAuth.ts @@ -74,7 +74,7 @@ export async function redirectToLogin(config = null, force = false) { sessionStorage.setItem('oauthState', state); console.log('Redirecting to OAUTH provider'); location.replace( - `${config.oauth}?client_id=dbgate&response_type=code&redirect_uri=${encodeURIComponent( + `${config.oauth}?client_id=${config.oauthClient}&response_type=code&redirect_uri=${encodeURIComponent( location.origin + location.pathname )}&state=${encodeURIComponent(state)}` ); @@ -83,7 +83,7 @@ export async function redirectToLogin(config = null, force = false) { } export function internalRedirectTo(path) { - const index = location.pathname.lastIndexOf('/'); +const index = location.pathname.lastIndexOf('/'); const newPath = index >= 0 ? location.pathname.substring(0, index) + path : path; location.replace(newPath); }