From c11fb425e39fb7705d7766a409b5af02a49f6442 Mon Sep 17 00:00:00 2001 From: Shuchang Zheng Date: Mon, 26 May 2025 13:28:20 -0700 Subject: [PATCH] TOTP endpoint update - support sending code that's less than or equal to 10 chars directly (#2464) --- skyvern/forge/sdk/routes/credentials.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/skyvern/forge/sdk/routes/credentials.py b/skyvern/forge/sdk/routes/credentials.py index d0c0b62e..625c1c30 100644 --- a/skyvern/forge/sdk/routes/credentials.py +++ b/skyvern/forge/sdk/routes/credentials.py @@ -69,8 +69,20 @@ async def send_totp_code( task_id=data.task_id, workflow_id=data.workflow_id, ) - code = await parse_totp_code(data.content) + content = data.content.strip() + code: str | None = content + # We assume the user is sending the code directly when the length of code is less than or equal to 10 + if len(content) > 10: + code = await parse_totp_code(content) if not code: + LOG.error( + "Failed to parse totp code", + totp_identifier=data.totp_identifier, + task_id=data.task_id, + workflow_id=data.workflow_id, + workflow_run_id=data.workflow_run_id, + content=data.content, + ) raise HTTPException(status_code=400, detail="Failed to parse totp code") return await app.DATABASE.create_totp_code( organization_id=curr_org.organization_id,