From 1e315e39cd73fe9773d80c1ed02a09140101165b Mon Sep 17 00:00:00 2001 From: LawyZheng Date: Tue, 5 Aug 2025 23:33:08 +0800 Subject: [PATCH] fix onepassword router (#3105) --- skyvern-frontend/src/hooks/useOnePasswordToken.ts | 8 ++++---- skyvern/forge/sdk/routes/credentials.py | 9 ++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/skyvern-frontend/src/hooks/useOnePasswordToken.ts b/skyvern-frontend/src/hooks/useOnePasswordToken.ts index 3d3b075b..da1a0ea4 100644 --- a/skyvern-frontend/src/hooks/useOnePasswordToken.ts +++ b/skyvern-frontend/src/hooks/useOnePasswordToken.ts @@ -17,9 +17,9 @@ export function useOnePasswordToken() { useQuery({ queryKey: ["onePasswordToken"], queryFn: async () => { - const client = await getClient(credentialGetter); + const client = await getClient(credentialGetter, "sans-api-v1"); return await client - .get("/auth-tokens/onepassword") + .get("/credentials/onepassword/get") .then((response) => response.data.token) .catch(() => null); }, @@ -27,9 +27,9 @@ export function useOnePasswordToken() { const createOrUpdateTokenMutation = useMutation({ mutationFn: async (data: CreateOnePasswordTokenRequest) => { - const client = await getClient(credentialGetter); + const client = await getClient(credentialGetter, "sans-api-v1"); return await client - .post("/auth-tokens/onepassword", data) + .post("/credentials/onepassword/create", data) .then((response) => response.data as CreateOnePasswordTokenResponse); }, onSuccess: () => { diff --git a/skyvern/forge/sdk/routes/credentials.py b/skyvern/forge/sdk/routes/credentials.py index 8b301735..b36937ae 100644 --- a/skyvern/forge/sdk/routes/credentials.py +++ b/skyvern/forge/sdk/routes/credentials.py @@ -375,7 +375,7 @@ async def get_credentials( @base_router.get( - "/credentials/onepassword", + "/credentials/onepassword/get", response_model=CreateOnePasswordTokenResponse, summary="Get OnePassword service account token", description="Retrieves the current OnePassword service account token for the organization.", @@ -385,7 +385,7 @@ async def get_credentials( }, ) @base_router.get( - "/credentials/onepassword/", + "/credentials/onepassword/get/", response_model=CreateOnePasswordTokenResponse, include_in_schema=False, ) @@ -400,7 +400,6 @@ async def get_onepassword_token( organization_id=current_org.organization_id, token_type=OrganizationAuthTokenType.onepassword_service_account, ) - if not auth_token: raise HTTPException( status_code=404, @@ -425,7 +424,7 @@ async def get_onepassword_token( @base_router.post( - "/credentials/onepassword", + "/credentials/onepassword/create", response_model=CreateOnePasswordTokenResponse, summary="Create or update OnePassword service account token", description="Creates or updates a OnePassword service account token for the current organization. Only one valid token is allowed per organization.", @@ -435,7 +434,7 @@ async def get_onepassword_token( }, ) @base_router.post( - "/credentials/onepassword/", + "/credentials/onepassword/create/", response_model=CreateOnePasswordTokenResponse, include_in_schema=False, )