fix: update Google OAuth redirect URI to use configuration setting
parent
7260c8d092
commit
6eefaf72db
|
|
@ -90,7 +90,7 @@ async def google_login():
|
||||||
raise HTTPException(status_code=501, detail="Google OAuth not configured.")
|
raise HTTPException(status_code=501, detail="Google OAuth not configured.")
|
||||||
params = {
|
params = {
|
||||||
"client_id": settings.GOOGLE_CLIENT_ID,
|
"client_id": settings.GOOGLE_CLIENT_ID,
|
||||||
"redirect_uri": f"{settings.FRONTEND_URL.rstrip('/')}/api/auth/google/callback",
|
"redirect_uri": settings.GOOGLE_REDIRECT_URI,
|
||||||
"response_type": "code",
|
"response_type": "code",
|
||||||
"scope": "openid email profile",
|
"scope": "openid email profile",
|
||||||
"access_type": "offline",
|
"access_type": "offline",
|
||||||
|
|
@ -112,7 +112,7 @@ async def google_callback(code: str, response: Response, db: AsyncSession = Depe
|
||||||
"code": code,
|
"code": code,
|
||||||
"client_id": settings.GOOGLE_CLIENT_ID,
|
"client_id": settings.GOOGLE_CLIENT_ID,
|
||||||
"client_secret": settings.GOOGLE_CLIENT_SECRET,
|
"client_secret": settings.GOOGLE_CLIENT_SECRET,
|
||||||
"redirect_uri": f"{settings.FRONTEND_URL.rstrip('/')}/api/auth/google/callback",
|
"redirect_uri": settings.GOOGLE_REDIRECT_URI,
|
||||||
"grant_type": "authorization_code",
|
"grant_type": "authorization_code",
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,10 @@ from pydantic_settings import BaseSettings
|
||||||
class Settings(BaseSettings):
|
class Settings(BaseSettings):
|
||||||
SECRET_KEY: str = "change-me-in-production-use-a-long-random-string"
|
SECRET_KEY: str = "change-me-in-production-use-a-long-random-string"
|
||||||
DATABASE_URL: str = "sqlite+aiosqlite:///./velxio.db"
|
DATABASE_URL: str = "sqlite+aiosqlite:///./velxio.db"
|
||||||
|
DATA_DIR: str = "."
|
||||||
GOOGLE_CLIENT_ID: str = ""
|
GOOGLE_CLIENT_ID: str = ""
|
||||||
GOOGLE_CLIENT_SECRET: str = ""
|
GOOGLE_CLIENT_SECRET: str = ""
|
||||||
|
GOOGLE_REDIRECT_URI: str = "http://localhost:8001/api/auth/google/callback"
|
||||||
FRONTEND_URL: str = "http://localhost:5173"
|
FRONTEND_URL: str = "http://localhost:5173"
|
||||||
ACCESS_TOKEN_EXPIRE_MINUTES: int = 10080 # 7 days
|
ACCESS_TOKEN_EXPIRE_MINUTES: int = 10080 # 7 days
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue