Remove OAuth scope restriction and improve API error messages

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
jtricerolph 2026-07-02 00:41:37 +00:00
parent 1eba56345f
commit 6742204546

View file

@ -31,7 +31,6 @@ async function getWorkforceToken() {
grant_type: 'password', grant_type: 'password',
username: creds.email, username: creds.email,
password: creds.password, password: creds.password,
scope: 'me',
}).toString(), }).toString(),
signal: AbortSignal.timeout(10000), signal: AbortSignal.timeout(10000),
}) })
@ -47,7 +46,10 @@ async function wfFetch(path) {
headers: { Authorization: `Bearer ${token}` }, headers: { Authorization: `Bearer ${token}` },
signal: AbortSignal.timeout(10000), 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() return res.json()
} }