Fix Workforce OAuth: use form-encoded body and correct scope
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
42be29b2ce
commit
1eba56345f
1 changed files with 4 additions and 4 deletions
|
|
@ -26,13 +26,13 @@ async function getWorkforceToken() {
|
||||||
}
|
}
|
||||||
const res = await fetch(`${baseUrl}/api/oauth/token`, {
|
const res = await fetch(`${baseUrl}/api/oauth/token`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||||
body: JSON.stringify({
|
body: new URLSearchParams({
|
||||||
grant_type: 'password',
|
grant_type: 'password',
|
||||||
username: creds.email,
|
username: creds.email,
|
||||||
password: creds.password,
|
password: creds.password,
|
||||||
scope: 'default',
|
scope: 'me',
|
||||||
}),
|
}).toString(),
|
||||||
signal: AbortSignal.timeout(10000),
|
signal: AbortSignal.timeout(10000),
|
||||||
})
|
})
|
||||||
if (!res.ok) throw new Error(`Workforce OAuth failed: ${res.status}`)
|
if (!res.ok) throw new Error(`Workforce OAuth failed: ${res.status}`)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue