User Defined (OAuth) Credentials Type Errors

Continuing the discussion from User Defined (OAuth) credential type with Azure AD:

I am facing the same problem when using User Defined (OAuth) Credentials Type.
In Postman it's working but in PureCloud I am havin an error.

Postman :

PureCloud side:
Integration

Configuration Custom Auth

Test Custom Action :

Here is the JSON returned:

{
"message": "The requested resource was not found.",
"code": "not.found",
"status": 404,
"messageParams": {},
"contextId": "4aac7ad6-2644-4eec-94ca-aeeb1405605a",
"details": [
{
"errorCode": "ACTION.REMOTE_ENDPOINT"
}
],
"errors": [
{
"message": "REST call for action execute failed. Message:Request to backend service failed. Response from web service: [4aac7ad6-2644-4eec-94ca-aeeb1405605a]",
"code": "NOT_FOUND",
"status": 404,
"messageParams": {},
"details": [],
"errors": []
}
]
}

Since in Postman, it is working fine, would you please help me translate to Data Actions in PureCloud ?

Thank you in advance,

Regards,

Also, I just copied the built-in Custom Auth action :

When I tested the Web Services Data Action (OAuth) (Copy), I got a different error :

I am getting a step 4 authentication error.
Any Ideas ?

Regards,

What it means is to execute the data action in postman using POST /api/v2/integrations/actions/{actionId}/execute. Your screenshot shows postman making requests to external services directly.

I have found a thread with the same problem as me

I think that I need to include the clientId and clientSecret to the Body and not to the Header as the documentations pointed out (https://help.mypurecloud.com/articles/how-to-use-the-user-defined-oauth-credential-type/)

I tried to add the same requestTemplate as suggested by @Jason_Mathison, but it didn't fixed the problem....

I have set only loginUrl, clientId and clientSecret at the integration level.

Any ideas ?

Regards,

CHARAF

Hey Charaf,

Have you been able to get this to work?

--Jason

Hi Jason,

Unfortunately, I couldn't make it working ....

Regards,

Hi Charaf,

It appears that you need to move all of your authentication information into the body instead of the headers.

This article includes a trivial example of form encoding. Specifically it shows the correct content-type header and a single key/value pair:

In your example you are going to need to have multiple key/value pairs in the request and need to make sure that the values are URL encoded. I would expect you to end up with a request template something like this:

client_id=$esc.url($credentials.clientId)&client_secret=$esc.url($credentials.clientSecret)&grant_type=client_credentials

That was hand crafted without being able to test it, so hopefully it is close enough that you can get it working.

--Jason

1 Like

Hey Charaf,

Any luck?

--Jason

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.