enh: ENABLE_OAUTH_EMAIL_FALLBACK

This commit is contained in:
Timothy Jaeryang Baek
2025-10-05 15:11:56 -05:00
parent c453d919b3
commit eaf786c1ef
2 changed files with 6 additions and 2 deletions
+3
View File
@@ -62,6 +62,7 @@ from open_webui.env import (
WEBUI_AUTH_COOKIE_SAME_SITE,
WEBUI_AUTH_COOKIE_SECURE,
ENABLE_OAUTH_ID_TOKEN_COOKIE,
ENABLE_OAUTH_EMAIL_FALLBACK,
OAUTH_CLIENT_INFO_ENCRYPTION_KEY,
)
from open_webui.utils.misc import parse_duration
@@ -1153,6 +1154,8 @@ class OAuthManager:
except Exception as e:
log.warning(f"Error fetching GitHub email: {e}")
raise HTTPException(400, detail=ERROR_MESSAGES.INVALID_CRED)
elif ENABLE_OAUTH_EMAIL_FALLBACK:
email = f"{provider_sub}.local"
else:
log.warning(f"OAuth callback failed, email is missing: {user_data}")
raise HTTPException(400, detail=ERROR_MESSAGES.INVALID_CRED)