Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: gitlab as VCS provider don't need repo in query (#1218)

h3n4l2ed0ddcb68ea
diff --git a/frontend/src/components/VCSSetupWizard.vue b/frontend/src/components/VCSSetupWizard.vue
index 8dc9cff0c2..19dbcd54f2 100644
--- a/frontend/src/components/VCSSetupWizard.vue
+++ b/frontend/src/components/VCSSetupWizard.vue
@@ -178,7 +178,8 @@ export default defineComponent({
const newWindow = openWindowForOAuth(
authorizeUrl,
state.config.applicationId,
- "bb.oauth.register-vcs"
+ "bb.oauth.register-vcs",
+ state.config.type
);
if (newWindow) {
state.oAuthResultCallback = (token: OAuthToken | undefined) => {
diff --git a/frontend/src/types/oauth.ts b/frontend/src/types/oauth.ts
index 52a6742264..25cf98fdee 100644
--- a/frontend/src/types/oauth.ts
+++ b/frontend/src/types/oauth.ts
@@ -1,4 +1,6 @@
-import { randomString } from "../utils";
+import { useWindowScroll } from "@vueuse/core";
+import { VCSType } from ".";
+import { randomString, vcsSlug } from "../utils";
export type OAuthConfig = {
endpoint: string;
@@ -36,16 +38,27 @@ export type OAuthType =
export function openWindowForOAuth(
endpoint: string,
applicationId: string,
- type: OAuthType
+ type: OAuthType,
+ vcsType: VCSType
): Window | null {
// we use type to determine oauth type when receiving the callback
const stateQueryParameter = `${type}-${randomString(20)}`;
sessionStorage.setItem(OAuthStateSessionKey, stateQueryParameter);
+ if (vcsType == "GITHUB_COM") {
+ return window.open(
+ `${endpoint}?client_id=${applicationId}&redirect_uri=${encodeURIComponent(
+ redirectUrl()
+ )}&state=${stateQueryParameter}&response_type=code&scope=api,repo`,
+ "oauth",
+ "location=yes,left=200,top=200,height=640,width=480,scrollbars=yes,status=yes"
+ );
+ }
+ // GITLAB_SELF_HOST
return window.open(
`${endpoint}?client_id=${applicationId}&redirect_uri=${encodeURIComponent(
redirectUrl()
- )}&state=${stateQueryParameter}&response_type=code&scope=api,repo`,
+ )}&state=${stateQueryParameter}&response_type=code&scope=api`,
"oauth",
"location=yes,left=200,top=200,height=640,width=480,scrollbars=yes,status=yes"
);