jcbowyer commited on
Commit
8eb7e2c
·
verified ·
1 Parent(s): dc83dae

Deploy: Consolidated gold tables, fixed nginx docs routing

Browse files
Files changed (1) hide show
  1. api/routes/auth.py +10 -1
api/routes/auth.py CHANGED
@@ -414,8 +414,17 @@ async def get_user_info(provider: str, access_token: str, config: dict) -> dict:
414
  elif provider == 'facebook':
415
  resp = await client.get(config['userinfo_url'], headers={'Authorization': f'Bearer {access_token}'})
416
  data = resp.json()
 
 
 
 
 
 
 
 
 
417
  user_info = {
418
- 'email': data.get('email'),
419
  'oauth_id': str(data.get('id')),
420
  'full_name': data.get('name'),
421
  'avatar_url': data.get('picture', {}).get('data', {}).get('url') if isinstance(data.get('picture'), dict) else None,
 
414
  elif provider == 'facebook':
415
  resp = await client.get(config['userinfo_url'], headers={'Authorization': f'Bearer {access_token}'})
416
  data = resp.json()
417
+
418
+ # Facebook may not return email if permission not approved in App Review
419
+ # Generate a placeholder email using Facebook ID if email not available
420
+ email = data.get('email')
421
+ if not email:
422
+ fb_id = data.get('id')
423
+ email = f"facebook_{fb_id}@communityone.placeholder"
424
+ logger.warning(f"Facebook did not return email for user {fb_id}. Using placeholder: {email}")
425
+
426
  user_info = {
427
+ 'email': email,
428
  'oauth_id': str(data.get('id')),
429
  'full_name': data.get('name'),
430
  'avatar_url': data.get('picture', {}).get('data', {}).get('url') if isinstance(data.get('picture'), dict) else None,