From f7f91748f3d58f98b6e64e04f2d09aadb39dbe8f Mon Sep 17 00:00:00 2001 From: Jacob Leksan Date: Tue, 4 Aug 2026 11:14:23 -0400 Subject: [PATCH] feat: add OAuth persistent configuration check to admin routes Prevents a user from changeing OAUTH settins in UI when they arent persistenct to imporve UX and clarity --- backend/open_webui/routers/auths.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/backend/open_webui/routers/auths.py b/backend/open_webui/routers/auths.py index 240c761931..c884949025 100644 --- a/backend/open_webui/routers/auths.py +++ b/backend/open_webui/routers/auths.py @@ -1440,13 +1440,23 @@ def oauth_config_updates(data: dict) -> dict: } +def _require_oauth_persistent_config(): + if not Config.OAUTH_PERSISTENT_ENABLED: + raise HTTPException( + status_code=status.HTTP_404_NOT_FOUND, + detail='OAuth admin configuration is disabled. Set ENABLE_OAUTH_PERSISTENT_CONFIG=true to enable.', + ) + + @router.get('/admin/config/oauth', response_model=OAuthConfigForm) async def get_oauth_config(request: Request, user=Depends(get_admin_user)): + _require_oauth_persistent_config() return await get_oauth_config_values() @router.post('/admin/config/oauth', response_model=OAuthConfigForm) async def update_oauth_config(request: Request, form_data: OAuthConfigForm, user=Depends(get_admin_user)): + _require_oauth_persistent_config() await Config.upsert(oauth_config_updates(form_data.model_dump(exclude_none=True))) return await get_oauth_config_values()