diff --git a/backend/open_webui/utils/oauth.py b/backend/open_webui/utils/oauth.py index 94a74dc86b..bc62dab637 100644 --- a/backend/open_webui/utils/oauth.py +++ b/backend/open_webui/utils/oauth.py @@ -1753,6 +1753,9 @@ class OAuthManager: user_oauth_groups = [] user_current_groups: list[GroupModel] = await Groups.get_groups_by_member_id(user.id, db=db) + if oauth_claim and claim_data is None and token_claims is not None and user_current_groups: + log.warning('Token exchange denied: no readable groups claim in userinfo or the token') + raise HTTPException(status.HTTP_403_FORBIDDEN, detail=ERROR_MESSAGES.ACCESS_PROHIBITED) all_available_groups: list[GroupModel] = await Groups.get_all_groups(db=db) # Create groups if they don't exist and creation is enabled