Enable Retrieving Username Claim from Userinfo Endpoint

This commit is contained in:
Markus Kofler 2025-08-13 16:27:25 +02:00 committed by GitHub
parent 438e5d966f
commit 2011e5711d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -355,7 +355,11 @@ class OAuthManager:
log.warning(f"OAuth callback error: {e}")
raise HTTPException(400, detail=ERROR_MESSAGES.INVALID_CRED)
user_data: UserInfo = token.get("userinfo")
if not user_data or auth_manager_config.OAUTH_EMAIL_CLAIM not in user_data:
if (
(not user_data) or
(auth_manager_config.OAUTH_EMAIL_CLAIM not in user_data) or
(auth_manager_config.OAUTH_USERNAME_CLAIM not in user_data)
):
user_data: UserInfo = await client.userinfo(token=token)
if not user_data:
log.warning(f"OAuth callback failed, user data is missing: {token}")