Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Added frontend for Github integration.

George Gale11e64febdb6f
diff --git a/frontend/pages/github.js b/frontend/pages/github.js
new file mode 100644
index 0000000000..af2b2b0874
--- /dev/null
+++ b/frontend/pages/github.js
@@ -0,0 +1,37 @@
+import React, { useEffect } from "react";
+import Head from "next/head";
+import { useRouter } from "next/router";
+const queryString = require("query-string");
+import AuthorizeIntegration from "./api/integrations/authorizeIntegration";
+
+export default function Github() {
+ const router = useRouter();
+ const parsedUrl = queryString.parse(router.asPath.split("?")[1]);
+ const code = parsedUrl.code;
+ const state = parsedUrl.state;
+
+ /**
+ * Here we forward to the default workspace if a user opens this url
+ */
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ useEffect(async () => {
+ try {
+ if (state === localStorage.getItem('latestCSRFToken')) {
+ localStorage.removeItem('latestCSRFToken');
+ await AuthorizeIntegration({
+ workspaceId: localStorage.getItem('projectData.id'),
+ code,
+ integration: "github",
+ });
+ router.push("/integrations/" + localStorage.getItem("projectData.id"));
+ }
+ } catch (error) {
+ console.error('Github integration error: ', error);
+ }
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, []);
+
+ return <div></div>;
+}
+
+Github.requireAuth = true;
diff --git a/frontend/pages/integrations/[id].js b/frontend/pages/integrations/[id].js
index 46aec22204..a5cb866be3 100644
--- a/frontend/pages/integrations/[id].js
+++ b/frontend/pages/integrations/[id].js
@@ -134,6 +134,9 @@ export default function Integrations() {
case 'Netlify':
window.location = `https://app.netlify.com/authorize?client_id=${integrationOption.clientId}&response_type=code&redirect_uri=${integrationOption.redirectURL}&state=${state}`;
break;
+ case 'Github':
+ window.location = `https://github.com.com/login/oauth/authorize?client_id=${integrationOption.clientId}&response_type=code&redirect_uri=${integrationOption.redirectURL}&state=${state}`;
+ break;
case 'Fly.io':
console.log('fly.io');
setIntegrationAccessTokenDialogOpen(true);