mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-22 09:31:58 -05:00
[PR #24535] [CLOSED] feat: separate OAUTH_NAME_CLAIM from OAUTH_USERNAME_CLAIM #82586
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/24535
Author: @astoeffer
Created: 5/10/2026
Status: ❌ Closed
Base:
dev← Head:feat/oauth-name-claim📝 Commits (1)
7f035eafeat: separate OAUTH_NAME_CLAIM from OAUTH_USERNAME_CLAIM📊 Changes
2 files changed (+29 additions, -6 deletions)
View changed files
📝
backend/open_webui/config.py(+11 -0)📝
backend/open_webui/utils/oauth.py(+18 -6)📄 Description
Why
OIDC providers commonly distinguish between two distinct user fields:
preferred_username— a stable login handle (e.g.student01,j.smith)name— the human display name (e.g.Anna Schmidt,Jane Smith)Today the OAuth user-provisioning code in
backend/open_webui/utils/oauth.pyusesOAUTH_USERNAME_CLAIMfor both the username AND the display name, forcing operators to make a Hobsons choice:OAUTH_USERNAME_CLAIMset topreferred_usernamestudent01student01(wrong)nameAnna Schmidt(URL-unfriendly, contains spaces)Anna SchmidtNeither option is satisfactory for any non-trivial OIDC integration where the IdP returns proper structured profile data.
What
Add a new
OAUTH_NAME_CLAIMenv var, separate fromOAUTH_USERNAME_CLAIM. Backwards-compatible: when unset, behaviour is unchanged (falls back toOAUTH_USERNAME_CLAIM).Where
Two call sites in
backend/open_webui/utils/oauth.pyuse the same logic:name = user_data.get(name_claim) ...OAUTH_UPDATE_NAME_ON_LOGINpath:new_name = user_data.get(name_claim) ...Both now resolve to
OAUTH_NAME_CLAIM or OAUTH_USERNAME_CLAIM.The "using email as name" warning was generalized to mention both env vars so operators can debug missing claims faster.
Tested
Built locally + tested against Authentik 2024.10. With
OAUTH_NAME_CLAIM=nameset, OIDC provisioning now creates the user with:username:student01(frompreferred_username)name:Anna Schmidt(fromnameclaim)Without
OAUTH_NAME_CLAIMset, behaviour is byte-identical to current.Diff stats
No DB migrations, no frontend changes, no breaking changes.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.