Legacy Dev Forum Posts

 View Only

Sign Up

Integration with value calculated in Autorization Header

  • 1.  Integration with value calculated in Autorization Header

    Posted 06-05-2025 18:43

    eherrera | 2021-12-01 22:33:31 UTC | #1

    Hi. I am doing integration and Configuration Data Action is:

    { "requestUrlTemplate": "https://REDACTED_SECRETS.suitetalk.api.netsuite.com/services/rest/query/v1/suiteql?limit=5", "requestType": "POST", "headers": { "Content-Type": "application/x-www-form-urlencoded", "Transfer-Encoding": "buffered", "Accept": "/", "UserAgent": "PureCloudIntegrations/1.0", "Authorization": "OAuth realm=\"5567660\",oauth_consumerkey=\"REDACTEDSECRETS\",oauthtoken=\"REDACTEDSECRETS\",oauthsignaturemethod=\"HMAC-SHA256\",oauthtimestamp=\"1638395574\",oauthnonce=\"REDACTEDSECRETS\",oauthversion=\"1.0\",oauthsignature=\"REDACTEDSECRETS\"" }, "requestTemplate": "{\n\n\"q\": \"SELECT c.id, c.altname, c.email, c.phone, c.altphone, c.custentityidclienteprestashop, c.custentityentityrfm, rfm.name AS usertype FROM customer c LEFT JOIN customlist3030 rfm ON ( c.custentityentityrfm = rfm.id) WHERE c.isinactive = 'F' AND c.phone='REDACTED_SECRETS' AND c.currency = 5 \"\n}" }

    The test answer is:

    { "message": "No authentication bearer token specified in authorization header.", "code": "authentication.required", "status": 401, "messageParams": {}, "contextId": "a4c42829-397a-45d1-ac0b-9a3dc4064629", "details": [ { "errorCode": "ACTION.REMOTEENDPOINT" } ], "errors": [ { "message": "REST call for action execute failed. Message:Request to backend service failed. Response from web service: {\"type\":\"https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2\",\"title\":\"Unauthorized\",\"status\":401,\"o:errorDetails\":[{\"detail\":\"Invalid login attempt. For more details, see the Login Audit Trail in the NetSuite UI at Setup > Users/Roles > User Management > View Login Audit Trail.\",\"o:errorCode\":\"INVALIDLOGIN\"}]}\n [a4c42829-397a-45d1-ac0b-9a3dc4064629]", "code": "AUTHENTICATION_REQUIRED", "status": 401, "messageParams": {}, "details": [], "errors": [] } ] }

    I valide the answer find that, in the portal of NetSuite there are example in JAVA (JS):

    • oauth_timestamp is resuled of function "Math.round(+new Date() / 1000)".
    • oauth_nonce is a random value wiht 32 length off the combination off letter an number: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".
    • oauthsignature is in Java process for function "CryptoJS.HmacSHA256(completeData, CONSUMERSECRET + '&' + TOKENSECRET)". After Base64.stringify and encodeURIComponent encoding result. I have CONSUMERSECRET and TOKEN_SECRET value.

    But i don´t know what do in Genesys Cloud. Can you give me some idea how to do this?

    Best regards, Edward.


    tim.smith | 2021-12-01 22:39:15 UTC | #2

    Welcome to the forum @eherrera! As a friendly reminder, this is a public forum so we ask that you please redact all secrets and PII before posting detailed information. I have edited your post above to that effect.

    eherrera, post:1, topic:12817
    • oauth_timestamp is resuled of function "Math.round(+new Date() / 1000)".
    • oauth_nonce is a random value wiht 32 length off the combination off letter an number: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".
    • oauthsignature is in Java process for function "CryptoJS.HmacSHA256(completeData, CONSUMERSECRET + '&' + TOKENSECRET)". After Base64.stringify and encodeURIComponent encoding result. I have CONSUMERSECRET and TOKEN_SECRET value.

    These requirements aren't going to be possible directly in a data action. You can find information about the supported data action credential types here: https://help.mypurecloud.com/articles/credential-types-web-services-data-actions-integration/

    To integrate with services that don't fit neatly into the data action integration's requirements, you'll need to implement a middleware to proxy the request from the Genesys Cloud data action to the destination service. This is often accomplished using something like AWS API Gateway and AWS Lambda or a heroku app, but the technology you choose is entirely your choice as long as it can translate between the two sides.


    eherrera | 2021-12-01 23:24:29 UTC | #3

    Than for their answer and edit and change my secrets word. I have present for next time.

    I learn the solution with AWS API Gateway and AWS Lambda.

    Best regards, Edward.


    system | 2022-01-01 23:25:23 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: 12817