Add these variables to your .env file in the backend directory:
GOOGLE_CLIENT_ID=your_google_client_id_here GOOGLE_CLIENT_SECRET=your_google_client_secret_here GOOGLE_CALLBACK_URL=http://localhost:5000/api/auth/google/callback
FRONTEND_URL=http://localhost:5173
SESSION_SECRET=your_very_secure_session_secret_here
- Go to Google Cloud Console (https://console.cloud.google.com/)
- Create a new project or select an existing one
- Enable the Google+ API
- Go to "Credentials" in the left sidebar
- Click "Create Credentials" > "OAuth 2.0 Client IDs"
- Choose "Web application"
- Add authorized redirect URIs:
- For development: http://localhost:5000/api/auth/google/callback
- For production: https://yourdomain.com/api/auth/google/callback
- Copy the Client ID and Client Secret to your .env file
GOOGLE_CLIENT_ID=123456789-abcdefghijklmnopqrstuvwxyz.apps.googleusercontent.com GOOGLE_CLIENT_SECRET=GOCSPX-abcdefghijklmnopqrstuvwxyz123456 GOOGLE_CALLBACK_URL=http://localhost:5000/api/auth/google/callback FRONTEND_URL=http://localhost:5173 SESSION_SECRET=super-secure-session-secret-change-this-in-production