{"status": "error", "code": "400", "message": "Invalid request body"}
Okay, so the SvelteKit server route is acting as the proxy.
It’s there to keep the CLIENT_SECRET away from the browser.
The frontend sends the data to the server, then the server calls the API.
Basically, it’s a SECURITY layer so we don’t leak credentials.
Trying to hit POST /api/v2/oauth/clients but it’s FAILING.
const response = await fetch('https://api.mypurecloud.com/api/v2/oauth/clients', {
method: 'POST',
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json'
},
body: JSON.stringify(clientData)
});
The clientData object is formatted exactly as the spec wants.
I’ve tried clearing the session and refreshing the token.
STILL getting a 400.