victordibia commited on
Commit
e8ad71f
·
1 Parent(s): b8ddd52

Deploy 2026-01-28 11:09:31

Browse files
src/flow/ui/auth/router.py CHANGED
@@ -162,14 +162,20 @@ async def github_oauth_start(
162
  # Generate state token for CSRF protection
163
  state = secrets.token_urlsafe(32)
164
 
 
 
 
 
 
 
165
  # Store the redirect URI with the state (where to send user after auth)
166
- callback_uri = redirect_uri or str(request.base_url).rstrip("/")
167
  _oauth_states[state] = callback_uri
168
 
169
  # Build GitHub authorization URL
170
  params = {
171
  "client_id": settings.github_client_id,
172
- "redirect_uri": f"{str(request.base_url).rstrip('/')}/api/auth/github/callback",
173
  "scope": "read:user",
174
  "state": state,
175
  }
 
162
  # Generate state token for CSRF protection
163
  state = secrets.token_urlsafe(32)
164
 
165
+ # Get base URL, respecting X-Forwarded-Proto header for reverse proxies (HF Spaces, etc.)
166
+ base_url = str(request.base_url).rstrip("/")
167
+ forwarded_proto = request.headers.get("x-forwarded-proto")
168
+ if forwarded_proto == "https" and base_url.startswith("http://"):
169
+ base_url = "https://" + base_url[7:]
170
+
171
  # Store the redirect URI with the state (where to send user after auth)
172
+ callback_uri = redirect_uri or base_url
173
  _oauth_states[state] = callback_uri
174
 
175
  # Build GitHub authorization URL
176
  params = {
177
  "client_id": settings.github_client_id,
178
+ "redirect_uri": f"{base_url}/api/auth/github/callback",
179
  "scope": "read:user",
180
  "state": state,
181
  }
src/flow/ui/ui/assets/index-BU8a-zoU.js ADDED
The diff for this file is too large to render. See raw diff
 
src/flow/ui/ui/index.html CHANGED
@@ -8,7 +8,7 @@
8
  <link rel="preconnect" href="https://fonts.googleapis.com">
9
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
10
  <link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&display=swap" rel="stylesheet">
11
- <script type="module" crossorigin src="/assets/index-2zMAgGgo.js"></script>
12
  <link rel="stylesheet" crossorigin href="/assets/index-BHAF8mLj.css">
13
  </head>
14
  <body>
 
8
  <link rel="preconnect" href="https://fonts.googleapis.com">
9
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
10
  <link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&display=swap" rel="stylesheet">
11
+ <script type="module" crossorigin src="/assets/index-BU8a-zoU.js"></script>
12
  <link rel="stylesheet" crossorigin href="/assets/index-BHAF8mLj.css">
13
  </head>
14
  <body>