charaf_ed | 2020-07-16 16:39:02 UTC | #1
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.REMOTEENDPOINT" } ], "errors": [ { "message": "REST call for action execute failed. Message:Request to backend service failed. Response from web service: [4aac7ad6-2644-4eec-94ca-aeeb1405605a]", "code": "NOTFOUND", "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,
charaf_ed | 2020-07-16 17:10:57 UTC | #2
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,
tim.smith | 2020-07-16 21:23:45 UTC | #3
charaf_ed, post:1, topic:8309
Since in Postman, it is working fine
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.
charaf_ed | 2020-07-17 07:56:23 UTC | #4
I have found a thread with the same problem as me https://developer.mypurecloud.com/forum/t/how-to-add-form-data-in-purecloud-action-request/5307
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
Jason_Mathison | 2020-07-22 16:17:26 UTC | #5
Hey Charaf,
Have you been able to get this to work?
--Jason
charaf_ed | 2020-07-22 16:55:37 UTC | #6
Hi Jason,
Unfortunately, I couldn't make it working ....
Regards,
Jason_Mathison | 2020-07-27 14:30:29 UTC | #7
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: https://help.mypurecloud.com/articles/how-to-use-the-user-defined-oauth-credential-type/
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
Jason_Mathison | 2020-07-31 11:50:34 UTC | #8
Hey Charaf,
Any luck?
--Jason
system | 2020-08-31 11:50:39 UTC | #9
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 8309