From 2011e5711da5c965a52fd5fd944cd99bb6bba3f0 Mon Sep 17 00:00:00 2001 From: Markus Kofler <32816694+koflerm@users.noreply.github.com> Date: Wed, 13 Aug 2025 16:27:25 +0200 Subject: [PATCH] Enable Retrieving Username Claim from Userinfo Endpoint --- backend/open_webui/utils/oauth.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/open_webui/utils/oauth.py b/backend/open_webui/utils/oauth.py index 131c35800e..105f7c2fab 100644 --- a/backend/open_webui/utils/oauth.py +++ b/backend/open_webui/utils/oauth.py @@ -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}")