mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-10 03:28:53 +00:00
Refactor auth error handling in auth_callback to improve clarity and change status code to 400
This commit is contained in:
parent
f7406b441f
commit
d9b264ba13
1 changed files with 7 additions and 2 deletions
|
|
@ -1311,9 +1311,14 @@ async def auth_callback(request: Request, state: Optional[str] = None): # noqa:
|
|||
oauth_error = request.query_params.get("error")
|
||||
oauth_error_description = request.query_params.get("error_description")
|
||||
if oauth_error:
|
||||
oauth_error_detail = f"OAuth error: {oauth_error}"
|
||||
if oauth_error_description:
|
||||
oauth_error_detail += (
|
||||
f", error_description: {oauth_error_description}"
|
||||
)
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail=f"OAuth error: {oauth_error}, error_description: {oauth_error_description}",
|
||||
status_code=400,
|
||||
detail=oauth_error_detail,
|
||||
)
|
||||
|
||||
# Check if this is a CLI login (state starts with our CLI prefix)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue