Skip to content

Commit 7a0dc0e

Browse files
authored
Merge pull request #459 from MODSetter/dev
feat: add BACKEND_URL configuration for OAuth redirect
2 parents 5174f21 + 4a3f681 commit 7a0dc0e

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

surfsense_backend/app/app.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,14 @@ def registration_allowed():
6868
app.include_router(
6969
fastapi_users.get_oauth_router(
7070
google_oauth_client, auth_backend, SECRET, is_verified_by_default=True
71+
)
72+
if not config.BACKEND_URL
73+
else fastapi_users.get_oauth_router(
74+
google_oauth_client,
75+
auth_backend,
76+
SECRET,
77+
is_verified_by_default=True,
78+
redirect_url=f"{config.BACKEND_URL}/auth/google/callback",
7179
),
7280
prefix="/auth/google",
7381
tags=["auth"],

surfsense_backend/app/config/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ class Config:
9797
DATABASE_URL = os.getenv("DATABASE_URL")
9898

9999
NEXT_FRONTEND_URL = os.getenv("NEXT_FRONTEND_URL")
100+
# Backend URL to override the http to https in the OAuth redirect URI
101+
BACKEND_URL = os.getenv("BACKEND_URL")
100102

101103
# Auth
102104
AUTH_TYPE = os.getenv("AUTH_TYPE")

0 commit comments

Comments
 (0)