Legacy Dev Forum Posts

 View Only

Sign Up

Data actions and using response from Auth integration

  • 1.  Data actions and using response from Auth integration

    Posted 06-05-2025 18:42

    fontenet | 2020-12-03 16:37:53 UTC | #1

    Hi,

    I am trying to accomplish the below:

    1. Make first API call, which contains KVP in the URL string needed for authentication and the response from this API will be an access token. The response of this API call is { access_token:"",

    refresh_token:"",

    1. I then need to store this access token in integrations and use it in data actions to make another API call to a different web service that has KVPs in the URL string and in the headers

    Steps I have taken:

    1. Created an integration with User Defined (OAuth) credential type for the access token api call and the following KVP

    loginUrl = https://exampleURL?{var}{var} etc..

    1. I then created an action for the second api call and had the following which failed the local test

    { "requestUrlTemplate": second API endpoint , "requestType": "GET", "headers": { "Authorization": "${authResponse.access_token}", "x-api-key": "Value" }, "requestTemplate": "${input.rawRequest}" }

    I tried following the below documentation https://help.mypurecloud.com/articles/how-to-use-the-user-defined-oauth-credential-type/

    but that did not work and I am getting the below error which does not make sense to me bc I do not have a clientId variable in the integration or my action.

    { "message": "Substitution values invalid in action config. Reference ${credentials.clientId} evaluated to null when attempting to render at HeadersTemplate:Authorization[line 1, column 25] A common reason for this error is needing to prepend the variable with 'input.' or 'credentials.'", "code": "invalid.substitution", "status": 400, "messageParams": {}, "contextId": "db221684-a710-4c96-9df4-4ab91d258978", "details": [ { "errorCode": "ACTION.PROCESSING" } ], "errors": [] }

    Regards, Leonardo


    Jason_Mathison | 2020-12-07 12:37:22 UTC | #2

    Hi Leonardo,

    For step 1, you should have done this work in the automatically created "Custom Auth" type Data Action, which will take care of making the access_token available to other actions in the Integration.

    Can you provide an export of the "Custom Auth" data action for the integration, as well as the action you are seeing the failure in? The exports will be .json files, feel free to redact the URL or anything else that is sensitive.

    If you feel uncomfortable publicly sharing exports of these data actions please open a case with customer care to troubleshoot your issue.

    --Jason


    fontenet | 2020-12-18 00:24:23 UTC | #3

    Hi Jason,

    Thank you for your reply. I was able to get this working by using multiple data actions.

    Regards, Leonardo


    system | 2021-01-18 00:24:24 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: 9437