feat: add Google OAuth login with USER role and pending approval flow
- Add GET /api/auth/google and GET /api/auth/callback/google routes with CSRF state protection and account linking via googleId - Add getPublicOrigin() for dynamic redirect_uri (supports reverse proxy via X-Forwarded-Proto) - Add USER role to schema (default for new Google sign-ins), make password optional, add googleId and image fields - Role-based redirect after login: USER → /profile, ADMIN/DEVELOPER → /dashboard - Profile page shows pending approval alert for USER role - Dashboard redirects USER role back to profile - Login page shows specific error messages per OAuth error code Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,7 @@ export const env = {
|
||||
PORT: parseInt(optional('PORT', '3000'), 10),
|
||||
NODE_ENV: optional('NODE_ENV', 'development'),
|
||||
REACT_EDITOR: optional('REACT_EDITOR', 'code'),
|
||||
BASE_URL: optional('BUN_PUBLIC_BASE_URL', 'http://localhost:3000'),
|
||||
DATABASE_URL: required('DATABASE_URL'),
|
||||
GOOGLE_CLIENT_ID: required('GOOGLE_CLIENT_ID'),
|
||||
GOOGLE_CLIENT_SECRET: required('GOOGLE_CLIENT_SECRET'),
|
||||
|
||||
Reference in New Issue
Block a user