Skip to content

Commit e6da607

Browse files
committed
feat: add support for login with github
1 parent e5cd13d commit e6da607

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

.env.sample

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ SECRET_MANAGER_SECRET_PATH=/
3535
INFISICAL_URL=https://app.infisical.com
3636
INFISICAL_TOKEN=
3737

38+
# GitHub OAuth (social login via GitHub App)
39+
# Uses the same Client ID/Secret from your GitHub App settings
40+
GITHUB_APP_CLIENT_ID=
41+
GITHUB_APP_CLIENT_SECRET=
42+
3843
# Cloudflare Turnstile (CAPTCHA)
3944
# Get keys at https://dash.cloudflare.com/turnstile
4045
# For local dev, use test key: 1x0000000000000000000000000000000AA (always passes)

src/auth/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,16 @@ export const auth = betterAuth({
4040
await emailService.sendResetPassword({ email: user.email, url, token });
4141
},
4242
},
43+
...(config.githubClientId && config.githubClientSecret
44+
? {
45+
socialProviders: {
46+
github: {
47+
clientId: config.githubClientId,
48+
clientSecret: config.githubClientSecret,
49+
},
50+
},
51+
}
52+
: {}),
4353
advanced: {
4454
database: {
4555
generateId: 'uuid',

src/config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ export const config = {
6565
// Passkey (WebAuthn) configuration
6666
passkeyRpId: process.env.PASSKEY_RP_ID || new URL(process.env.AUTH_SERVICE_URL || 'http://localhost').hostname,
6767

68+
// GitHub OAuth (social login via GitHub App)
69+
githubClientId: process.env.GITHUB_APP_CLIENT_ID || '',
70+
githubClientSecret: process.env.GITHUB_APP_CLIENT_SECRET || '',
71+
6872
// SSH configuration (for installer-generated SSH keys)
6973
sshHost: process.env.SSH_HOST || '',
7074
sshPort: parseInt(process.env.SSH_PORT || '22', 10),

0 commit comments

Comments
 (0)