Skip to content

Automate browser based workflows with AI

TOTP endpoint update - support sending code that's less than or equal to 10 chars directly (#2464)

Shuchang Zhengc11fb425e39f
diff --git a/skyvern/forge/sdk/routes/credentials.py b/skyvern/forge/sdk/routes/credentials.py
index d0c0b62ef..625c1c300 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,