From f0598b3f59a7c581cb820fcc9a4e41643ecfdfee Mon Sep 17 00:00:00 2001 From: charlesgauthereau Date: Tue, 30 Dec 2025 10:42:51 +0100 Subject: [PATCH] Adding support for github provider. --- portabase.config.ts | 16 +++++++--------- src/lib/auth/auth.ts | 8 +++++++- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/portabase.config.ts b/portabase.config.ts index a7ce6ea8..320ecf0e 100644 --- a/portabase.config.ts +++ b/portabase.config.ts @@ -84,21 +84,19 @@ export const SUPPORTED_PROVIDERS: AuthProviderConfig[] = [ isActive: Boolean(process.env.AUTH_GOOGLE_METHOD), // isManual: true, credentials: { - clientId: process.env.GOOGLE_CLIENT_ID || "", - clientSecret: process.env.GOOGLE_CLIENT_SECRET || "", + clientId: process.env.AUTH_GOOGLE_ID || "", + clientSecret: process.env.AUTH_GOOGLE_SECRET || "", }, }, - /* { id: "github", - name: "GitHub", - icon: Github, - description: "Connexion via GitHub", + icon: "iconoir:github", + isActive: Boolean(process.env.AUTH_GITHUB_METHOD), credentials: { - clientId: process.env.GITHUB_CLIENT_ID || "", - clientSecret: process.env.GITHUB_CLIENT_SECRET || "", + clientId: process.env.AUTH_GITHUB_ID || "", + clientSecret: process.env.AUTH_GITHUB_SECRET || "", }, - },*/ + }, { id: "credential", isActive: true, diff --git a/src/lib/auth/auth.ts b/src/lib/auth/auth.ts index 67855e3a..7ede4d3c 100644 --- a/src/lib/auth/auth.ts +++ b/src/lib/auth/auth.ts @@ -79,7 +79,7 @@ export const auth = betterAuth({ }); }, }, - socialProviders: SUPPORTED_PROVIDERS.reduce((acc: any, provider: any) => { + socialProviders: SUPPORTED_PROVIDERS.reduce((acc: any, provider: AuthProviderConfig) => { if (!provider.isActive) return acc; if (provider.id === "credential") return acc; if (provider.id === "google") { @@ -88,6 +88,12 @@ export const auth = betterAuth({ clientSecret: env.AUTH_GOOGLE_SECRET! as string, }; } + if (provider.id === "github") { + acc.github = { + clientId: provider.credentials?.clientId, + clientSecret: provider.credentials?.clientSecret, + }; + } return acc; }, {}), account: {