feat: integrate Google OAuth authentication provider and add login UI button

This commit is contained in:
Jose Selesan
2026-04-20 10:16:02 -03:00
parent 5b53a10bbc
commit a4075866f8
4 changed files with 85 additions and 1 deletions

View File

@@ -12,3 +12,7 @@ SMTP_PORT=587
SMTP_USER=user@example.com
SMTP_PASS=your-smtp-password
SMTP_FROM=Playzer <no-reply@example.com>
# Google OAuth
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret

View File

@@ -17,7 +17,21 @@ export const auth = betterAuth({
emailAndPassword: {
enabled: true,
},
trustedOrigins: [process.env.APP_BASE_URL ?? 'http://localhost:5173'],
socialProviders: {
google: {
clientId: process.env.GOOGLE_CLIENT_ID!,
clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
},
},
advanced: {
generateUsername: async (data) => {
return `user_${Date.now()}`;
},
},
trustedOrigins: [
process.env.APP_BASE_URL ?? 'http://localhost:5173',
process.env.BETTER_AUTH_URL ?? 'http://localhost:3000',
],
plugins: [openAPI()],
});