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

@@ -88,7 +88,26 @@ Biome is used (not ESLint). Config in `biome.json`:
- `BETTER_AUTH_SECRET`, `BETTER_AUTH_URL` - Auth core
- `APP_BASE_URL` - Frontend URL for trusted origins
- `CORS_ORIGIN` - Frontend URL for CORS policy
- `GOOGLE_CLIENT_ID`, `GOOGLE_CLIENT_SECRET` - Google OAuth (see below)
**Frontend** (`apps/frontend/.env`):
- `VITE_*` prefix required (Vite embeds these at build time)
- `VITE_API_BASE_URL` - Backend URL (default: http://localhost:3000)
## Google OAuth
To enable login with Google:
1. Create OAuth credentials in Google Cloud Console:
- Application type: Web application
- Authorized redirect URI: `{BETTER_AUTH_URL}/api/auth/callback/google`
2. Add env vars to `.env.example`:
```
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret
```
3. The backend configures `socialProviders.google` automatically.
4. Frontend uses `authClient.signIn.social({ provider: 'google', callbackURL: 'http://localhost:5173' })`.