diff --git a/backend/open_webui/utils/oauth.py b/backend/open_webui/utils/oauth.py index 70d130804..0569da98d 100644 --- a/backend/open_webui/utils/oauth.py +++ b/backend/open_webui/utils/oauth.py @@ -277,8 +277,13 @@ class OAuthManager: picture_url = "" if not picture_url: picture_url = "/user.png" + username_claim = auth_manager_config.OAUTH_USERNAME_CLAIM + username = user_data.get(username_claim) + if not isinstance(username, str): + username = "User" + role = self.get_user_role(None, user_data) user = Auths.insert_new_auth( @@ -286,7 +291,7 @@ class OAuthManager: password=get_password_hash( str(uuid.uuid4()) ), # Random password, not used - name=user_data.get(username_claim, "User"), + name=username, profile_image_url=picture_url, role=role, oauth_sub=provider_sub,