Google Vertex AI的access token获取接口补上说明
This commit is contained in:
parent
79d10570e7
commit
a05cf7b069
|
|
@ -138,8 +138,11 @@ async def list_files(headers: Annotated[GoogleAPIKeyHeaders, Header()]):
|
||||||
return JSONResponse(content=response.json() if len(response.text) > 0 else "", status_code=response.status_code)
|
return JSONResponse(content=response.json() if len(response.text) > 0 else "", status_code=response.status_code)
|
||||||
|
|
||||||
|
|
||||||
@router.get('/access-token', summary="获取一个新的Google Access Token", dependencies=[Depends(verify_token)])
|
@router.get('/access-token', summary="获取一个新的Google Access Token",
|
||||||
|
description="获取的Access Token最多同时存在35000个",
|
||||||
|
dependencies=[Depends(verify_token)])
|
||||||
async def get_access_token() -> GoogleAuthUtils.GoogleAuthResponse:
|
async def get_access_token() -> GoogleAuthUtils.GoogleAuthResponse:
|
||||||
|
# GOOGLE_AUTH_JSON 通过modal secrets 配置
|
||||||
service_account_json = os.environ.get("GOOGLE_AUTH_JSON", None)
|
service_account_json = os.environ.get("GOOGLE_AUTH_JSON", None)
|
||||||
if not service_account_json:
|
if not service_account_json:
|
||||||
raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail="Missing Google IAM Service Account JSON")
|
raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail="Missing Google IAM Service Account JSON")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue