beeScottie | 2022-09-19 02:13:46 UTC | #1
Similar to several other posts, I've got a Postman Collection which includes an Access Token that works absolutely fine and can be renewed for 60 minutes at a time. Having read the other posts, at least one had success though hadn't posted exactly how... https://developer.genesys.cloud/forum/t/web-service-integration-with-third-party/15912 https://developer.genesys.cloud/forum/t/web-service-integration-with-third-party/15912 https://developer.genesys.cloud/forum/t/user-defined-oauth-credential-type-with-azure-ad/7687
In our case, the request body needs the following parameters: granttype scope clientid client_secret
These are all setup as credential fields like following in the Auth Action:
{ "name": "BS Data Actions (Auth) - Exported 2022-09-19 @ 13:38", "integrationType": "custom-rest-actions", "actionType": "customAuth", "config": { "request": { "requestUrlTemplate": "${credentials.loginUrl}", "requestType": "POST", "headers": { "Content-Type": "application/x-www-form-urlencoded" }, "requestTemplate": "clientid=$esc.url($credentials.clientId)&clientsecret=$esc.url($credentials.clientSecret)&granttype=clientcredentials&scope=$esc.url($credentials.scope)" }
Response from the Web Service: { "message": "The requested resource was not found.", "code": "not.found", "status": 404, "messageParams": {}, "contextId": "7eba034f-48ae-4549-a10e-de1ec3417aee", "details": [ { "errorCode": "ACTION.REMOTEENDPOINT" } ], "errors": [ { "message": "REST call for action execute failed. Message: Request to backend service failed. Response from web service: [7eba034f-48ae-4549-a10e-de1ec3417aee]", "code": "NOTFOUND", "status": 404, "messageParams": {}, "details": [], "errors": [] } ] }
Have tried with and without esc.url and also with and without encoding.base64. The response received is the standard Azure AD response as expected. Just very hard to figure out what is wrong without a log.
Jason_Mathison | 2022-09-22 20:45:24 UTC | #2
Hi beeScottie,
First thing to try: https://help.mypurecloud.com/articles/custom-action-fails-for-unexpected-reason/
If that doesn't work, another option is to setup something like mockable.io or ngrok to proxy one of your authentication requests and see what is actually getting sent.
--Jason
beeScottie | 2022-09-19 02:53:46 UTC | #3
beeScottie, post:1, topic:16337
clientid=$esc.url($credentials.clientId)&clientsecret=$esc.url($credentials.clientSecret)&granttype=clientcredentials&scope=$esc.url($credentials.scope)
Hi Jason,
Success!!!
I had tried the buffered transfer encoding earlier but obviously didn't have the right combination of things at the right time.
For anyone following along at home, note that only the clientId and clientSecret are $esc.url encoded and Transfer-Enoding must be set to buffered in order to get a valid response.
Now I'm getting a valid repsonse, will move onto the next part and try to use this token in some flows. Thanks for the great suggestion @Jason_Mathison
Cheers,
Brendon
system | 2022-10-20 02:53:50 UTC | #4
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: 16337