Fix Workforce connection test: use form-encoded OAuth body
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
a886b4b30e
commit
e84b916ecf
1 changed files with 2 additions and 2 deletions
|
|
@ -91,8 +91,8 @@ export async function integrationRoutes(app) {
|
||||||
const baseUrl = creds.base_url || 'https://my.workforce.com'
|
const baseUrl = creds.base_url || 'https://my.workforce.com'
|
||||||
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({ grant_type: 'password', username: creds.email, password: creds.password, scope: 'default' }),
|
body: new URLSearchParams({ grant_type: 'password', username: creds.email, password: creds.password, scope: 'me' }).toString(),
|
||||||
signal: AbortSignal.timeout(8000),
|
signal: AbortSignal.timeout(8000),
|
||||||
})
|
})
|
||||||
if (!res.ok) throw new Error(`Workforce auth failed (${res.status})`)
|
if (!res.ok) throw new Error(`Workforce auth failed (${res.status})`)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue