Remove OAuth scope restriction and improve API error messages
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
1eba56345f
commit
6742204546
1 changed files with 4 additions and 2 deletions
|
|
@ -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()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue