Web Services Bearer Token Error

Hello, I'm trying to create a custom data action that generates a bearer token.

This is the current set up:

However, when I'm testing it, I get this error:

Whereas in Postman, it generates the token and returns 200 status code. What could I be possibly missing?

Thank you!

Based on the error message, it looks like you may be trying to edit/test a custom action, not the "custom auth action" that is used to get the auth token.

Yes, this was a duplicate action from the automatically published auth action. The reason I had to edit it is because I was getting this error:

{
  "message": "The request could not be understood by the server due to malformed syntax.",
  "code": "bad.request",
  "status": 400,
  "messageParams": {},
  "contextId": "cced244f-8ab6-4d86-bf0a-5f3a51abc98a",
  "details": [
    {
      "errorCode": "ACTION.REMOTE_ENDPOINT"
    }
  ],
  "errors": [
    {
      "message": "REST call for action execute failed. Message: Request to backend service failed. Response from web service: {\"error\":\"invalid_request\",\"error_description\":\"AADSTS90014: The required field 'scope' is missing from the credential. Ensure that you have all the necessary parameters for the login request. Trace ID: 2cf2ae15-522c-4d92-b841-0d43375e7800 Correlation ID: a52102d2-fa3b-4eda-b401-7c467a9e72e2 Timestamp: 2024-05-06 15:22:18Z\",\"error_codes\":[90014],\"timestamp\":\"2024-05-06 15:22:18Z\",\"trace_id\":\"2cf2ae15-522c-4d92-b841-0d43375e7800\",\"correlation_id\":\"a52102d2-fa3b-4eda-b401-7c467a9e72e2\",\"error_uri\":\"https://login.microsoftonline.com/error?code=90014\"} [cced244f-8ab6-4d86-bf0a-5f3a51abc98a]",
      "code": "BAD_REQUEST",
      "status": 400,
      "messageParams": {},
      "details": [],
      "errors": []
    }
  ]
}

So I tried to add the scope in request body template and transfer-encoding in the header, but still not working.

Since this is authentication related you might be best off to work with Genesys support about what is different between what you have working in postman and what your Data Action is trying to do.

I have never seen the clientId be used as a scope before, is it possible that is supposed to be something else?