mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 10:58:17 -05:00
[PR #23535] [CLOSED] feat: add support for custom SSO/OAuth providers #27243
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/23535
Author: @RoryChou-flux
Created: 4/9/2026
Status: ❌ Closed
Base:
dev← Head:feat/custom-sso-providers📝 Commits (10+)
fe6783cMerge pull request #19030 from open-webui/devfc05e0aMerge pull request #19405 from open-webui/deve3faec6Merge pull request #19416 from open-webui/dev9899293Merge pull request #19448 from open-webui/dev140605eMerge pull request #19462 from open-webui/dev6f1486fMerge pull request #19466 from open-webui/devd95f533Merge pull request #19729 from open-webui/deva7271530.6.43 (#20093)6adde20Merge pull request #20394 from open-webui/devf9b0534Merge pull request #20522 from open-webui/dev📊 Changes
8 files changed (+867 additions, -134 deletions)
View changed files
📝
backend/open_webui/config.py(+134 -1)📝
backend/open_webui/main.py(+14 -1)📝
backend/open_webui/routers/auths.py(+133 -0)📝
backend/open_webui/utils/oauth.py(+41 -18)📝
src/lib/apis/auths/index.ts(+100 -0)📝
src/lib/components/admin/Settings.svelte(+4 -1)📝
src/lib/components/admin/Settings/General.svelte(+364 -2)📝
src/routes/auth/+page.svelte(+77 -111)📄 Description
Pull Request Checklist
devmain.feat:Changelog Entry
Description
Allow administrators to configure multiple custom OAuth/SSO providers at runtime via Admin UI or
CUSTOM_OAUTH_PROVIDERS_CONFIGenvironment variable. This enables use cases like multiple Feishu enterprises, multiple OIDC providers, or any OAuth2-compatible provider — without code changes.Currently, Open WebUI hardcodes 5 OAuth providers (Google, Microsoft, GitHub, OIDC, Feishu), each limited to a single instance. Users who need multiple instances of the same provider type (e.g., two Feishu apps for different enterprises) must modify source code.
Added
CUSTOM_OAUTH_PROVIDERS_CONFIGPersistentConfig for dynamic custom OAuth provider storage (supports both env var JSON array and Admin UI)_build_custom_provider_register()helper to create Authlib OAuth clients from config dicts/api/v1/auths/admin/config/oauth/customfor managing custom OAuth providerssub_claim,email_claim,username_claim,picture_claim,email_fallbackprovider_typefield on all providers to generalize type-specific logic (e.g., Feishu data unwrap)reload_providers()method on OAuthManager for hot-reloading after config changes_is_valid_custom_slug()validator used in both env loader and admin API{#each}loop (replaces hardcoded{#if}blocks)Changed
/api/configresponse:oauth.providersvalues changed from plain strings to objects{name, icon_url, is_custom, provider_type}provider_type == 'feishu'instead ofprovider == 'feishu'nameandprovider_typefieldssub_claimfixed fromuser_idtoopen_idto match actual Feishu v1 userinfo API responseDeprecated
Removed
Fixed
sub_claim: user_id— Feishu v1 userinfo endpoint returnsopen_id, notuser_idSecurity
***) in admin API GET responsesgithubprovider only (prevents token leak from custom providers)CUSTOM_OAUTH_PROVIDERS_CONFIGenv var handled gracefully (falls back to empty array with warning)Breaking Changes
/api/configoauth.providersresponse format changed from{key: name_string}to{key: {name, icon_url, is_custom, provider_type}}. This only affects the bundled frontend (updated in this PR) and any external consumers of this internal API.Additional Information
Configuration via environment variable:
No database migration needed — custom provider configs stored in existing
configtable JSON blob;User.oauthandOAuthSession.provideralready support arbitrary keys.Screenshots or Videos
Tested locally with real Feishu OAuth:
{"feishu": {"name": "Feishu", ...}, "feishu-b": {"name": "飞书企业B", "is_custom": true, ...}}Testing Steps
FEISHU_CLIENT_ID+CUSTOM_OAUTH_PROVIDERS_CONFIG(two Feishu providers)/api/configreturns both providers in new object formatContributor License Agreement
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.