From 9d404d04d5eae54bef94bc7f10bb16bd89acb40b Mon Sep 17 00:00:00 2001 From: mohamad Date: Sun, 1 Jun 2025 22:43:02 +0200 Subject: [PATCH] Update OAuth redirect URIs and API routing structure - Changed the Google and Apple redirect URIs in the configuration to include the API version in the path. - Reorganized the inclusion of OAuth routes in the main application to ensure they are properly prefixed and accessible. These updates aim to enhance the API structure and ensure consistency in the authentication flow. --- be/app/config.py | 4 ++-- be/app/main.py | 9 +++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/be/app/config.py b/be/app/config.py index 1803e39..dbfe5e6 100644 --- a/be/app/config.py +++ b/be/app/config.py @@ -120,13 +120,13 @@ Organic Bananas # 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" + GOOGLE_REDIRECT_URI: str = "http://localhost:8000/api/v1/auth/google/callback" APPLE_CLIENT_ID: str = "" APPLE_TEAM_ID: str = "" APPLE_KEY_ID: str = "" APPLE_PRIVATE_KEY: str = "" - APPLE_REDIRECT_URI: str = "http://localhost:8000/auth/apple/callback" + APPLE_REDIRECT_URI: str = "http://localhost:8000/api/v1/auth/apple/callback" # Session Settings SESSION_SECRET_KEY: str = "your-session-secret-key" # Change this in production diff --git a/be/app/main.py b/be/app/main.py index 3fde609..139ff6f 100644 --- a/be/app/main.py +++ b/be/app/main.py @@ -154,6 +154,9 @@ async def refresh_jwt_token( ) # --- Include API Routers --- +# Include OAuth routes first (no auth required) +app.include_router(oauth_router, prefix="/auth", tags=["auth"]) + # Include FastAPI-Users routes app.include_router( fastapi_users.get_auth_router(auth_backend), @@ -181,14 +184,8 @@ app.include_router( tags=["users"], ) -# Include OAuth routes -# app.include_router(oauth_router, prefix="/auth", tags=["auth"]) - # Include your API router app.include_router(api_router, prefix=settings.API_PREFIX) - -# Include OAuth routes under the main API prefix -app.include_router(oauth_router, prefix=f"{settings.API_PREFIX}/auth", tags=["auth"]) # --- End Include API Routers --- # Health check endpoint