From 0586d83c16ff43d5770b064a365574c7a6960b68 Mon Sep 17 00:00:00 2001 From: AlexSze Date: Fri, 24 Apr 2026 17:49:53 +0800 Subject: [PATCH] add fix to auth error --- litellm/proxy/management_endpoints/ui_sso.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/litellm/proxy/management_endpoints/ui_sso.py b/litellm/proxy/management_endpoints/ui_sso.py index 46e7963da7c..2be0158c6cd 100644 --- a/litellm/proxy/management_endpoints/ui_sso.py +++ b/litellm/proxy/management_endpoints/ui_sso.py @@ -1308,6 +1308,14 @@ async def auth_callback(request: Request, state: Optional[str] = None): # noqa: """Verify login""" verbose_proxy_logger.info(f"Starting SSO callback with state: {state}") + oauth_error = request.query_params.get("error") + oauth_error_description = request.query_params.get("error_description") + if oauth_error: + raise HTTPException( + status_code=401, + detail=f"OAuth error: {oauth_error}, error_description: {oauth_error_description}", + ) + # Check if this is a CLI login (state starts with our CLI prefix) from litellm.constants import LITELLM_CLI_SESSION_TOKEN_PREFIX from litellm.proxy._types import LiteLLM_JWTAuth