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