forked from phoenix/litellm-mirror
(fix) use dynamic redirect urls
This commit is contained in:
parent
30d4ec9221
commit
378ab212c1
1 changed files with 11 additions and 4 deletions
|
@ -2854,8 +2854,11 @@ async def user_auth(request: Request):
|
||||||
|
|
||||||
|
|
||||||
@app.get("/google-login", tags=["experimental"])
|
@app.get("/google-login", tags=["experimental"])
|
||||||
async def google_login():
|
async def google_login(request: Request):
|
||||||
GOOGLE_REDIRECT_URI = "http://localhost:4000/google-callback"
|
scheme = request.url.scheme
|
||||||
|
host = request.url.hostname
|
||||||
|
port = request.url.port or 4000
|
||||||
|
GOOGLE_REDIRECT_URI = f"{scheme}://{host}:{port}/google-callback"
|
||||||
GOOGLE_CLIENT_ID = (
|
GOOGLE_CLIENT_ID = (
|
||||||
"246483686424-clje5sggkjma26ilktj6qssakqhoon0m.apps.googleusercontent.com"
|
"246483686424-clje5sggkjma26ilktj6qssakqhoon0m.apps.googleusercontent.com"
|
||||||
)
|
)
|
||||||
|
@ -2864,10 +2867,14 @@ async def google_login():
|
||||||
|
|
||||||
|
|
||||||
@app.get("/google-callback", tags=["experimental"], response_model=GenerateKeyResponse)
|
@app.get("/google-callback", tags=["experimental"], response_model=GenerateKeyResponse)
|
||||||
async def google_callback(code: str):
|
async def google_callback(code: str, request: Request):
|
||||||
import httpx
|
import httpx
|
||||||
|
|
||||||
GOOGLE_REDIRECT_URI = "http://localhost:4000/google-callback"
|
scheme = request.url.scheme
|
||||||
|
host = request.url.hostname
|
||||||
|
port = request.url.port or 4000
|
||||||
|
|
||||||
|
GOOGLE_REDIRECT_URI = f"{scheme}://{host}:{port}/google-callback"
|
||||||
GOOGLE_CLIENT_ID = (
|
GOOGLE_CLIENT_ID = (
|
||||||
"246483686424-clje5sggkjma26ilktj6qssakqhoon0m.apps.googleusercontent.com"
|
"246483686424-clje5sggkjma26ilktj6qssakqhoon0m.apps.googleusercontent.com"
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue