Data Action - POST to /api/v2/users/{userId}/oauth/tokens failing

“{"message":"Invalid request body","code":"INVALID_REQUEST_BODY","details":[]}” - seriously? That’s it? Like, thanks Genesys, super helpful.

We’ve got a Data Action in a PROD IVR - version 20240229-165546 - trying to POST to /api/v2/users/{userId}/oauth/tokens. It’s supposed to grab a user’s OAuth token using the SDK v3.0.2 (Node.js). The flow’s supposed to pass the token to a downstream system for screen pops, but it’s just failing consistently.

The userId is being populated correctly, I’ve checked that a thousand times. It’s coming from the CONTEXT.user.id field which, you know, should be pretty reliable. The Data Action’s configured with a JSON payload that should work, or at least not explode with a “Invalid request body” error. Here’s what we’re sending:

{
 "grantType": "client_credentials",
 "clientId": "YOUR_CLIENT_ID",
 "clientSecret": "YOUR_CLIENT_SECRET"
}

Obviously, I’ve redacted the actual client ID and secret. The app’s permissions are all set up. SCOPEs are correct. I’ve triple-checked the APPLICATION_SETTINGS and the OAuth Client configuration.

The weirdest part is, I can take that exact same payload, curl it from my laptop, and it works perfectly fine. It’s the Data Action that’s choking. I’m starting to suspect it’s something to do with how the SDK handles the JSON serialization. Maybe it’s adding some extra garbage characters or quoting something wrong?

I tried setting the Content-Type header to application/json in the Data Action, but that didn’t change anything. Honestly, the lack of detail in the error message feels like a personal attack. Like, could we maybe get a hint as to what is invalid about the request? I’ve even tried adding a dummy field to the payload, just to see if it rejects it. Nope. Still just “Invalid request body”.

Anyone else run into this lovely little gem? The CLIENT_CREDENTIALS flow should be straightforward.