diff --git a/frontend/src/pages/integrations/github/auth-mode-selection.tsx b/frontend/src/pages/integrations/github/auth-mode-selection.tsx index e5f96636f..d47d22ec6 100644 --- a/frontend/src/pages/integrations/github/auth-mode-selection.tsx +++ b/frontend/src/pages/integrations/github/auth-mode-selection.tsx @@ -1,5 +1,6 @@ import crypto from "crypto"; +import { useState } from "react"; import Head from "next/head"; import Image from "next/image"; import Link from "next/link"; @@ -7,13 +8,27 @@ import { useRouter } from "next/router"; import { faArrowUpRightFromSquare, faBookOpen } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { Button, Card, CardTitle } from "@app/components/v2"; +import { + Button, + Card, + CardBody, + CardTitle, + FormControl, + Select, + SelectItem +} from "@app/components/v2"; import { useGetCloudIntegrations } from "@app/hooks/api"; +enum AuthMethod { + APP = "APP", + OAUTH = "OAUTH" +} + export default function GithubIntegrationAuthModeSelectionPage() { const router = useRouter(); const { data: cloudIntegrations } = useGetCloudIntegrations(); const githubIntegration = cloudIntegrations?.find((integration) => integration.slug === "github"); + const [selectedAuthMethod, setSelectedAuthMethod] = useState(AuthMethod.APP); return (
@@ -50,37 +65,41 @@ export default function GithubIntegrationAuthModeSelectionPage() {
-
- - -
+ window.location.assign( + `https://github.com/login/oauth/authorize?client_id=${githubIntegration?.clientId}&response_type=code&scope=repo,admin:org&redirect_uri=${window.location.origin}/integrations/github/oauth2/callback&state=${state}` + ); + } + }} + colorSchema="primary" + variant="outline_bg" + className="mb-4 mt-4 ml-auto w-min" + > + Connect to Github + + + );