diff --git a/src/workforce.js b/src/workforce.js index b1f5ecd..d6085a2 100644 --- a/src/workforce.js +++ b/src/workforce.js @@ -31,7 +31,6 @@ async function getWorkforceToken() { grant_type: 'password', username: creds.email, password: creds.password, - scope: 'me', }).toString(), signal: AbortSignal.timeout(10000), }) @@ -47,7 +46,10 @@ async function wfFetch(path) { headers: { Authorization: `Bearer ${token}` }, signal: AbortSignal.timeout(10000), }) - if (!res.ok) throw new Error(`Workforce API error ${res.status} at ${path}`) + if (!res.ok) { + const body = await res.text().catch(() => '') + throw new Error(`Workforce API error ${res.status} at ${path}${body ? ': ' + body.slice(0, 200) : ''}`) + } return res.json() }