forked from phoenix/litellm-mirror
(fix) google auth
This commit is contained in:
parent
dc78d16d05
commit
3699df2b31
1 changed files with 5 additions and 3 deletions
|
@ -2859,9 +2859,11 @@ async def user_auth(request: Request):
|
||||||
|
|
||||||
@app.get("/google-login", tags=["experimental"])
|
@app.get("/google-login", tags=["experimental"])
|
||||||
async def google_login(request: Request):
|
async def google_login(request: Request):
|
||||||
scheme = request.url.scheme
|
scheme = request.url.scheme or "https"
|
||||||
host = request.url.hostname
|
host = request.url.hostname or "localhost"
|
||||||
port = request.url.port or 4000
|
port = request.url.port or 4000
|
||||||
|
if "localhost" not in host:
|
||||||
|
scheme = "https"
|
||||||
GOOGLE_REDIRECT_URI = f"{scheme}://{host}:{port}/google-callback"
|
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"
|
||||||
|
@ -2874,7 +2876,7 @@ async def google_login(request: Request):
|
||||||
async def google_callback(code: str, request: Request):
|
async def google_callback(code: str, request: Request):
|
||||||
import httpx
|
import httpx
|
||||||
|
|
||||||
scheme = request.url.scheme
|
scheme = request.url.scheme or "https"
|
||||||
host = request.url.hostname or "localhost"
|
host = request.url.hostname or "localhost"
|
||||||
port = request.url.port or 4000
|
port = request.url.port or 4000
|
||||||
if "localhost" not in host:
|
if "localhost" not in host:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue