[GH-ISSUE #12325] issue: Microsoft SSO Profile Pictures Causing Severe Performance Degradation in Admin Panels #16556

Closed
opened 2026-04-19 22:27:10 -05:00 by GiteaMirror · 5 comments
Owner

Originally created by @MushroomLamp-COB on GitHub (Apr 2, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/12325

Check Existing Issues

  • I have searched the existing issues and discussions.
  • I am using the latest version of Open WebUI.

Installation Method

Git Clone

Open WebUI Version

v0.6.0

Ollama Version (if applicable)

NA

Operating System

Amazon Linux (EC2, Docker container)

Browser (if applicable)

NA

Confirmation

  • I have read and followed all instructions in README.md.
  • I am using the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have listed steps to reproduce the bug in detail.

Expected Behavior

Microsoft SSO authentication should work efficiently without causing significant performance degradation.
There should be an option to use default profile images instead of loading images from the OAuth provider.
When setting a non-existent claim in OAUTH_PICTURE_CLAIM, it should fall back to the default user image rather than the provider's picture URL

Actual Behavior

Microsoft SSO authentication works, but it causes extreme performance issues when loading user data.
The Knowledgebase section and Users section in the admin panel for us took approximately 30 seconds to load just 5 users, pulling large base64 strings. (there are some large images in our tenancy)

Setting OAUTH_PICTURE_CLAIM to a non-existent claim (e.g., "no-claim") doesn't work as expected because the code falls back to the provider's picture URL rather than using the default image.
The application retrieves full-size profile pictures (1-10MB) rather than thumbnails, causing significant load times.

Steps to Reproduce

  1. Set up Open WebUI v0.6.0 with Docker on EC2 (Amazon Linux)
  2. Use external postgres database
  3. Configure Microsoft Entra SSO integration with the proper environment variables
  4. Have users authenticate with Microsoft SSO
  5. Attempt to access the Knowledgebase section or Users section in the admin panel
  6. Observe longer than expected load times for the knowledgebase, and users section in admin panel
  7. Attempt to resolve by setting OAUTH_PICTURE_CLAIM="no-claim" in your environment variables
  8. Notice that this doesn't resolve the issue as the code falls back to the OAuth provider's hardcoded picture URL (OAUTH_PROVIDERS)

Logs & Screenshots

NA

Additional Information

Root Cause:
The issue is in backend/open_webui/utils/oauth.py at line 330, where the code is designed to fall back to the OAuth provider's picture URL rather than an empty string when the specified claim doesn't exist:

picture_url = user_data.get( picture_claim, OAUTH_PROVIDERS[provider].get("picture_url", "")

This means that when OAUTH_PICTURE_CLAIM is set to a non-existent claim, instead of using an empty string (which would trigger the default user image), it falls back to whatever is defined in
OAUTH_PROVIDERS[provider].get("picture_url", "").

Solution:
Change line 330 in backend/open_webui/utils/oauth.py from:

picture_url = user_data.get( picture_claim, OAUTH_PROVIDERS[provider].get("picture_url", "")

To:

picture_url = user_data.get(picture_claim, "")

This change ensures that when a claim doesn't exist, it falls back to an empty string, which causes the application to use the default user image (user.png) instead of attempting to load the images from Microsoft Entra.

I think that a better solution would be to create an environment variable for OAUTH_USE_PICTURE_CLAIM (bool) to toggle between using the picture claim, or the user.png

Originally created by @MushroomLamp-COB on GitHub (Apr 2, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/12325 ### Check Existing Issues - [x] I have searched the existing issues and discussions. - [x] I am using the latest version of Open WebUI. ### Installation Method Git Clone ### Open WebUI Version v0.6.0 ### Ollama Version (if applicable) NA ### Operating System Amazon Linux (EC2, Docker container) ### Browser (if applicable) NA ### Confirmation - [x] I have read and followed all instructions in `README.md`. - [x] I am using the latest version of **both** Open WebUI and Ollama. - [x] I have included the browser console logs. - [x] I have included the Docker container logs. - [x] I have listed steps to reproduce the bug in detail. ### Expected Behavior Microsoft SSO authentication should work efficiently without causing significant performance degradation. There should be an option to use default profile images instead of loading images from the OAuth provider. When setting a non-existent claim in OAUTH_PICTURE_CLAIM, it should fall back to the default user image rather than the provider's picture URL ### Actual Behavior Microsoft SSO authentication works, but it causes extreme performance issues when loading user data. The Knowledgebase section and Users section in the admin panel for us took approximately 30 seconds to load just 5 users, pulling large base64 strings. (there are some large images in our tenancy) Setting OAUTH_PICTURE_CLAIM to a non-existent claim (e.g., "no-claim") doesn't work as expected because the code falls back to the provider's picture URL rather than using the default image. The application retrieves full-size profile pictures (1-10MB) rather than thumbnails, causing significant load times. ### Steps to Reproduce 1. Set up Open WebUI v0.6.0 with Docker on EC2 (Amazon Linux) 2. Use external postgres database 3. Configure Microsoft Entra SSO integration with the proper environment variables 4. Have users authenticate with Microsoft SSO 5. Attempt to access the Knowledgebase section or Users section in the admin panel 6. Observe longer than expected load times for the knowledgebase, and users section in admin panel 7. Attempt to resolve by setting OAUTH_PICTURE_CLAIM="no-claim" in your environment variables 8. Notice that this doesn't resolve the issue as the code falls back to the OAuth provider's hardcoded picture URL (OAUTH_PROVIDERS) ### Logs & Screenshots NA ### Additional Information Root Cause: The issue is in backend/open_webui/utils/oauth.py at line 330, where the code is designed to fall back to the OAuth provider's picture URL rather than an empty string when the specified claim doesn't exist: `picture_url = user_data.get( picture_claim, OAUTH_PROVIDERS[provider].get("picture_url", "")` This means that when OAUTH_PICTURE_CLAIM is set to a non-existent claim, instead of using an empty string (which would trigger the default user image), it falls back to whatever is defined in `OAUTH_PROVIDERS[provider].get("picture_url", "").` Solution: Change line 330 in backend/open_webui/utils/oauth.py from: `picture_url = user_data.get( picture_claim, OAUTH_PROVIDERS[provider].get("picture_url", "")` To: `picture_url = user_data.get(picture_claim, "")` This change ensures that when a claim doesn't exist, it falls back to an empty string, which causes the application to use the default user image (user.png) instead of attempting to load the images from Microsoft Entra. I think that a better solution would be to create an environment variable for OAUTH_USE_PICTURE_CLAIM (bool) to toggle between using the picture claim, or the user.png
GiteaMirror added the bug label 2026-04-19 22:27:10 -05:00
Author
Owner

@tjbck commented on GitHub (Apr 2, 2025):

PR Welcome.

<!-- gh-comment-id:2772302290 --> @tjbck commented on GitHub (Apr 2, 2025): PR Welcome.
Author
Owner

@MushroomLamp-COB commented on GitHub (Apr 3, 2025):

PR Welcome.

Thanks, PR raised
#12376

This is my first PR, hopefully all is ok!

<!-- gh-comment-id:2774133458 --> @MushroomLamp-COB commented on GitHub (Apr 3, 2025): > PR Welcome. Thanks, PR raised #12376 This is my first PR, hopefully all is ok!
Author
Owner

@tjbck commented on GitHub (Apr 3, 2025):

7a1e10f3a7

Removed OAUTH_USE_PICTURE_CLAIM in favour of setting OAUTH_PICTURE_CLAIM to empty string. Thanks!

<!-- gh-comment-id:2774200829 --> @tjbck commented on GitHub (Apr 3, 2025): 7a1e10f3a79912088b55edd9bd892500da163d7d Removed `OAUTH_USE_PICTURE_CLAIM` in favour of setting `OAUTH_PICTURE_CLAIM` to empty string. Thanks!
Author
Owner

@MushroomLamp-COB commented on GitHub (Apr 3, 2025):

7a1e10f

Removed OAUTH_USE_PICTURE_CLAIM in favour of setting OAUTH_PICTURE_CLAIM to empty string. Thanks!

Thanks @tjbck

Does this mean we will set OAUTH_PICTURE_CLAIM rather than use a OAUTH_USE_PICTURE_CLAIM env going forward?

<!-- gh-comment-id:2774309753 --> @MushroomLamp-COB commented on GitHub (Apr 3, 2025): > [7a1e10f](https://github.com/open-webui/open-webui/commit/7a1e10f3a79912088b55edd9bd892500da163d7d) > > Removed `OAUTH_USE_PICTURE_CLAIM` in favour of setting `OAUTH_PICTURE_CLAIM` to empty string. Thanks! Thanks @tjbck Does this mean we will set OAUTH_PICTURE_CLAIM rather than use a OAUTH_USE_PICTURE_CLAIM env going forward?
Author
Owner

@tjbck commented on GitHub (Apr 3, 2025):

Yep! (e.g. OAUTH_PICTURE_CLAIM="")

<!-- gh-comment-id:2774328084 --> @tjbck commented on GitHub (Apr 3, 2025): Yep! (e.g. `OAUTH_PICTURE_CLAIM=""`)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#16556