[PR #9751] [MERGED] Fix: Setting OAUTH_USERNAME_CLAIM has no effect on username for user during oauth signup #22415

Closed
opened 2026-04-20 04:08:07 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/9751
Author: @pseudorm
Created: 2/10/2025
Status: Merged
Merged: 2/10/2025
Merged by: @tjbck

Base: devHead: bug/user-signup/fix-oauth-username-claim-has-no-effect


📝 Commits (3)

  • db0a12f check name is none
  • 1b6e12a add warning
  • 336d1d9 Merge branch 'dev' into bug/user-signup/fix-oauth-username-claim-has-no-effect

📊 Changes

1 file changed (+2 additions, -1 deletions)

View changed files

📝 backend/open_webui/utils/oauth.py (+2 -1)

📄 Description

The OAUTH_USERNAME_CLAIM environment variable currently does not affect the choice of username for users who signed up through OAuth.
This is due to a bug that sets the username to be the email if there's no user found on the DB with the same sub, when in fact there should not be such user on DB during first sign up.

Instead of checking if there's a user, this PR checks if there's a key matching value of OAUTH_USERNAME_CLAIM in the user_data OAuth client response, email is only used when such key is not found.

Fixes open-webui/open-webui#9753


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/9751 **Author:** [@pseudorm](https://github.com/pseudorm) **Created:** 2/10/2025 **Status:** ✅ Merged **Merged:** 2/10/2025 **Merged by:** [@tjbck](https://github.com/tjbck) **Base:** `dev` ← **Head:** `bug/user-signup/fix-oauth-username-claim-has-no-effect` --- ### 📝 Commits (3) - [`db0a12f`](https://github.com/open-webui/open-webui/commit/db0a12f9f19395531d8e261c8af1263a4dbe244d) check name is none - [`1b6e12a`](https://github.com/open-webui/open-webui/commit/1b6e12a2550782711474ab47e2484148f224ebde) add warning - [`336d1d9`](https://github.com/open-webui/open-webui/commit/336d1d95c5f7a1e12de3217df6f39fd72a30afd4) Merge branch 'dev' into bug/user-signup/fix-oauth-username-claim-has-no-effect ### 📊 Changes **1 file changed** (+2 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/utils/oauth.py` (+2 -1) </details> ### 📄 Description The `OAUTH_USERNAME_CLAIM` environment variable currently does not affect the choice of username for users who signed up through OAuth. This is due to a bug that sets the username to be the email if there's no user found on the DB with the same `sub`, when in fact there should not be such user on DB during first sign up. Instead of checking if there's a user, this PR checks if there's a key matching value of `OAUTH_USERNAME_CLAIM` in the `user_data` OAuth client response, email is only used when such key is not found. Fixes open-webui/open-webui#9753 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-20 04:08:07 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#22415