mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 18:54:30 +00:00
(fix) return dict response
This commit is contained in:
parent
dabc4591e7
commit
4e32c76fa8
1 changed files with 10 additions and 4 deletions
|
@ -2863,7 +2863,7 @@ async def google_login():
|
|||
return RedirectResponse(url=google_auth_url)
|
||||
|
||||
|
||||
@app.get("/google-callback", tags=["experimental"])
|
||||
@app.get("/google-callback", tags=["experimental"], response_model=GenerateKeyResponse)
|
||||
async def google_callback(code: str):
|
||||
import httpx
|
||||
|
||||
|
@ -2902,10 +2902,16 @@ async def google_callback(code: str):
|
|||
# we can use user_email on litellm proxy now
|
||||
|
||||
# TODO: Handle user info as needed, for example, store it in a database, authenticate the user, etc.
|
||||
return JSONResponse(
|
||||
content={"user_email": user_email, "user_name": user_name},
|
||||
status_code=200,
|
||||
response = await generate_key_helper_fn(
|
||||
**{"duration": "24hr", "models": [], "aliases": {}, "config": {}, "spend": 0, "user_id": user_email, "team_id": "litellm-dashboard"} # type: ignore
|
||||
)
|
||||
|
||||
key = response["token"] # type: ignore
|
||||
user_id = response["user_id"] # type: ignore
|
||||
{
|
||||
"key": key,
|
||||
"user_id": user_id,
|
||||
}
|
||||
else:
|
||||
# Handle user info retrieval error
|
||||
raise HTTPException(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue