From e84b916ecf1aa6709587bb1bda600ec9334267ab Mon Sep 17 00:00:00 2001 From: jtricerolph Date: Thu, 2 Jul 2026 00:35:55 +0000 Subject: [PATCH] Fix Workforce connection test: use form-encoded OAuth body Co-Authored-By: Claude Sonnet 4.6 --- src/routes/integrations.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/routes/integrations.js b/src/routes/integrations.js index c664791..d3cff8a 100644 --- a/src/routes/integrations.js +++ b/src/routes/integrations.js @@ -91,8 +91,8 @@ export async function integrationRoutes(app) { const baseUrl = creds.base_url || 'https://my.workforce.com' const res = await fetch(`${baseUrl}/api/oauth/token`, { method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ grant_type: 'password', username: creds.email, password: creds.password, scope: 'default' }), + headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, + body: new URLSearchParams({ grant_type: 'password', username: creds.email, password: creds.password, scope: 'me' }).toString(), signal: AbortSignal.timeout(8000), }) if (!res.ok) throw new Error(`Workforce auth failed (${res.status})`)