From 680c0057b1b8e7e86de6564bd975bc3797bf1f25 Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Thu, 5 Jan 2023 09:23:31 +0100 Subject: [PATCH] fixed client_id param in oauth #407 --- packages/api/src/controllers/config.js | 1 + packages/web/src/clientAuth.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) 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); }