jcbowyer commited on
Commit
7f63fd0
Β·
verified Β·
1 Parent(s): 0de4fbe

Deploy: Consolidated gold tables, fixed nginx docs routing

Browse files
api/routes/auth.py CHANGED
@@ -2,6 +2,8 @@
2
  OAuth authentication routes - HuggingFace, Google, Facebook, GitHub
3
  """
4
  import os
 
 
5
  import httpx
6
  from datetime import datetime, timedelta
7
  from typing import Optional
@@ -431,11 +433,27 @@ async def get_user_info(provider: str, access_token: str, config: dict) -> dict:
431
  }
432
 
433
  elif provider == 'facebook':
 
 
 
 
 
 
 
 
 
 
 
 
 
 
434
  # Facebook uses access token as query parameter, not Bearer header
435
- userinfo_url_with_token = f"{config['userinfo_url']}&access_token={access_token}"
 
436
 
437
  logger.info(f"πŸ” [FACEBOOK] Requesting user info from: {config['userinfo_url']}")
438
  logger.info(f"πŸ” [FACEBOOK] Access token (first 20 chars): {access_token[:20]}...")
 
439
 
440
  try:
441
  resp = await client.get(userinfo_url_with_token)
 
2
  OAuth authentication routes - HuggingFace, Google, Facebook, GitHub
3
  """
4
  import os
5
+ import hmac
6
+ import hashlib
7
  import httpx
8
  from datetime import datetime, timedelta
9
  from typing import Optional
 
433
  }
434
 
435
  elif provider == 'facebook':
436
+ # Facebook requires appsecret_proof for server-side API calls
437
+ # Generate HMAC-SHA256 hash of access token using app secret
438
+ app_secret = os.getenv('FACEBOOK_APP_SECRET')
439
+ if not app_secret:
440
+ logger.error("❌ [FACEBOOK] FACEBOOK_APP_SECRET not configured!")
441
+ return None
442
+
443
+ # Create appsecret_proof
444
+ appsecret_proof = hmac.new(
445
+ app_secret.encode('utf-8'),
446
+ access_token.encode('utf-8'),
447
+ hashlib.sha256
448
+ ).hexdigest()
449
+
450
  # Facebook uses access token as query parameter, not Bearer header
451
+ # Add appsecret_proof for security
452
+ userinfo_url_with_token = f"{config['userinfo_url']}&access_token={access_token}&appsecret_proof={appsecret_proof}"
453
 
454
  logger.info(f"πŸ” [FACEBOOK] Requesting user info from: {config['userinfo_url']}")
455
  logger.info(f"πŸ” [FACEBOOK] Access token (first 20 chars): {access_token[:20]}...")
456
+ logger.info(f"πŸ” [FACEBOOK] Generated appsecret_proof: {appsecret_proof[:20]}...")
457
 
458
  try:
459
  resp = await client.get(userinfo_url_with_token)
api/static/assets/index-BiXTU5yP.js ADDED
The diff for this file is too large to render. See raw diff