From 4fef6429702997c16fd3c48b510043bc84aebd88 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sun, 1 Jun 2025 21:13:48 +0000 Subject: [PATCH 01/14] Fix: Resolve Google OAuth redirection issue This commit addresses an issue where you, when clicking the "Continue with Google" button, were redirected back to the login page instead of to Google's authentication page. The following changes were made: 1. **Frontend Redirect:** * Modified `fe/src/components/SocialLoginButtons.vue` to make the "Continue with Google" button redirect to the correct backend API endpoint (`/auth/google/login`) using the configured `API_BASE_URL`. 2. **Backend Route Confirmation:** * Verified that the backend OAuth routes in `be/app/api/auth/oauth.py` are correctly included in `be/app/main.py` under the `/auth` prefix, making them accessible. 3. **OAuth Credentials Configuration:** * Added `GOOGLE_CLIENT_ID` and `GOOGLE_CLIENT_SECRET` placeholders to `env.production.template` to guide you in setting up your OAuth credentials. * Added instructional comments in `be/app/config.py` regarding the necessity of these environment variables and the correct configuration of `GOOGLE_REDIRECT_URI`. With these changes, and assuming the necessary Google Cloud OAuth credentials (Client ID, Client Secret) and redirect URIs are correctly configured in the environment, the Google OAuth flow should now function as expected. --- be/app/config.py | 5 +++++ env.production.template | 6 +++--- fe/src/components/SocialLoginButtons.vue | 3 ++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/be/app/config.py b/be/app/config.py index 4361114..1803e39 100644 --- a/be/app/config.py +++ b/be/app/config.py @@ -113,6 +113,11 @@ Organic Bananas AUTH_HEADER_PREFIX: str = "Bearer" # OAuth Settings + # IMPORTANT: For Google OAuth to work, you MUST set the following environment variables + # (e.g., in your .env file): + # GOOGLE_CLIENT_ID: Your Google Cloud project's OAuth 2.0 Client ID + # GOOGLE_CLIENT_SECRET: Your Google Cloud project's OAuth 2.0 Client Secret + # Ensure the GOOGLE_REDIRECT_URI below matches the one configured in your Google Cloud Console. GOOGLE_CLIENT_ID: str = "" GOOGLE_CLIENT_SECRET: str = "" GOOGLE_REDIRECT_URI: str = "http://localhost:8000/auth/google/callback" diff --git a/env.production.template b/env.production.template index a3e8582..b1948a6 100644 --- a/env.production.template +++ b/env.production.template @@ -30,9 +30,9 @@ VITE_API_URL=https://yourdomain.com/api VITE_SENTRY_DSN=your_frontend_sentry_dsn_here VITE_ROUTER_MODE=history -# OAuth Configuration (if using) -GOOGLE_CLIENT_ID=your_google_client_id -GOOGLE_CLIENT_SECRET=your_google_client_secret +# Google OAuth Configuration - Replace with your actual credentials +GOOGLE_CLIENT_ID="YOUR_GOOGLE_CLIENT_ID_HERE" +GOOGLE_CLIENT_SECRET="YOUR_GOOGLE_CLIENT_SECRET_HERE" GOOGLE_REDIRECT_URI=https://yourdomain.com/auth/google/callback APPLE_CLIENT_ID=your_apple_client_id diff --git a/fe/src/components/SocialLoginButtons.vue b/fe/src/components/SocialLoginButtons.vue index 524dc76..b54f0a0 100644 --- a/fe/src/components/SocialLoginButtons.vue +++ b/fe/src/components/SocialLoginButtons.vue @@ -35,11 +35,12 @@ diff --git a/fe/src/pages/GroupDetailPage.vue b/fe/src/pages/GroupDetailPage.vue index 1c9ca17..ac34505 100644 --- a/fe/src/pages/GroupDetailPage.vue +++ b/fe/src/pages/GroupDetailPage.vue @@ -1,11 +1,11 @@