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