Fix oauth link callback from mothership task

This commit is contained in:
Theodore Li
2026-03-06 13:42:52 -08:00
parent 6d803bcde2
commit 1e53d5748a
2 changed files with 7 additions and 3 deletions

View File

@@ -39,6 +39,7 @@ export async function orchestrateCopilotStream(
userId,
workflowId: '',
workspaceId,
chatId,
decryptedEnvVars,
}
}

View File

@@ -715,6 +715,7 @@ async function generateOAuthLink(
userId: string,
workspaceId: string | undefined,
workflowId: string | undefined,
chatId: string | undefined,
providerName: string,
baseUrl: string
): Promise<{ url: string; providerId: string; serviceName: string }> {
@@ -743,9 +744,10 @@ async function generateOAuthLink(
}
const { providerId, name: serviceName } = matched
const callbackURL =
workflowId && workspaceId
? `${baseUrl}/workspace/${workspaceId}/w/${workflowId}`
const callbackURL = workflowId && workspaceId
? `${baseUrl}/workspace/${workspaceId}/w/${workflowId}`
: chatId && workspaceId
? `${baseUrl}/workspace/${workspaceId}/task/${chatId}`
: `${baseUrl}/workspace/${workspaceId}`
// Trello and Shopify use custom auth routes, not genericOAuth
@@ -869,6 +871,7 @@ const SIM_WORKFLOW_TOOL_HANDLERS: Record<
c.userId,
c.workspaceId,
c.workflowId,
c.chatId,
providerName,
baseUrl
)