Donne120 Claude Fable 5 commited on
Commit
ce17f67
·
1 Parent(s): 435e654

fix: production frontend is chat.studentcompanionai.rw — allow CORS + redirect there

Browse files

The student PWA now lives at chat.studentcompanionai.rw (Vercel project
deploying Donne120/Student_companion), not the legacy vercel.app domains.
Add it to the default CORS origins and make it the default OAuth
post-consent redirect.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Files changed (2) hide show
  1. email_briefing.py +2 -2
  2. main.py +2 -1
email_briefing.py CHANGED
@@ -23,7 +23,7 @@ Configuration (HF Space secrets)
23
  GOOGLE_OAUTH_CLIENT_SECRET
24
  BACKEND_PUBLIC_URL e.g. https://studentcompanion-alu-chatbot.hf.space
25
  (used to build the redirect URI Google calls)
26
- FRONTEND_URL e.g. https://alustudentcompanion.vercel.app
27
  EMAIL_TOKEN_KEY optional Fernet key; if set, refresh tokens are
28
  encrypted at rest in Aurora
29
 
@@ -62,7 +62,7 @@ BACKEND_PUBLIC_URL = os.environ.get(
62
  "BACKEND_PUBLIC_URL", "https://studentcompanion-alu-chatbot.hf.space"
63
  ).rstrip("/")
64
  FRONTEND_URL = os.environ.get(
65
- "FRONTEND_URL", "https://alustudentcompanion.vercel.app"
66
  ).rstrip("/")
67
  REDIRECT_URI = f"{BACKEND_PUBLIC_URL}/api/email/oauth/callback"
68
 
 
23
  GOOGLE_OAUTH_CLIENT_SECRET
24
  BACKEND_PUBLIC_URL e.g. https://studentcompanion-alu-chatbot.hf.space
25
  (used to build the redirect URI Google calls)
26
+ FRONTEND_URL e.g. https://chat.studentcompanionai.rw
27
  EMAIL_TOKEN_KEY optional Fernet key; if set, refresh tokens are
28
  encrypted at rest in Aurora
29
 
 
62
  "BACKEND_PUBLIC_URL", "https://studentcompanion-alu-chatbot.hf.space"
63
  ).rstrip("/")
64
  FRONTEND_URL = os.environ.get(
65
+ "FRONTEND_URL", "https://chat.studentcompanionai.rw"
66
  ).rstrip("/")
67
  REDIRECT_URI = f"{BACKEND_PUBLIC_URL}/api/email/oauth/callback"
68
 
main.py CHANGED
@@ -54,7 +54,8 @@ app.add_middleware(SlowAPIMiddleware)
54
  # admin dashboard); CORS_ALLOWED_ORIGINS (comma-separated) ADDS to these. "*"
55
  # is still honored but only as an explicit, credential-less opt-in for local dev.
56
  _DEFAULT_ORIGINS = [
57
- "https://alu-student-companion.vercel.app", # student PWA
 
58
  "https://v0-database-for-student-companion.vercel.app", # admin dashboard (v0)
59
  ]
60
  _env_origins = [o.strip() for o in os.getenv("CORS_ALLOWED_ORIGINS", "").split(",") if o.strip()]
 
54
  # admin dashboard); CORS_ALLOWED_ORIGINS (comma-separated) ADDS to these. "*"
55
  # is still honored but only as an explicit, credential-less opt-in for local dev.
56
  _DEFAULT_ORIGINS = [
57
+ "https://chat.studentcompanionai.rw", # student PWA (production)
58
+ "https://alu-student-companion.vercel.app", # student PWA (legacy)
59
  "https://v0-database-for-student-companion.vercel.app", # admin dashboard (v0)
60
  ]
61
  _env_origins = [o.strip() for o in os.getenv("CORS_ALLOWED_ORIGINS", "").split(",") if o.strip()]