HTTP Request Credential

With the HTTP Request Credential type, data retrieved from the response of an HTTP Request can be used with a credential widget. When an action with a HTTP Request credential runs, Tines will run the corresponding HTTP Request options in the background and embed the data at the specified path in the response.

Creating a HTTP Request Credential

When creating a HTTP Request Credential, you will need to specify the name of the credential, HTTP Request options and the JSONPath where the data that should be used in the credential can be located in the response.

Example

Suppose we have HTTP Request options that make a request to a service to get an access token for subsequent requests. The action config for this action is shown below:

{
  "url": "https://www.token-generator.com/oauth2/token",
  "content_type": "form",
  "method": "post",
  "payload": {
    "assertion": "{% credential token_generator %}"
  }
}

When this action runs, it emits an event similar that shown below:

{
  "get_auth_token": {
    "body": {
      "access_token": "ya29.Gn9qB-2K9xbys1DCgzyXNrIWuIIE0CuoAuSj5dYqWiMa7JNjarCZxhjgxbPkAGtADLIck87KIuDtYp3o71NRppfyA2tpTfD1uRG6lsjfoQD4g86jbzyjcTLbOn-oD_i8eQf4hQnUhkcrrktQ70GBJmnLwrOCaH7bTthMQLzV21p5",
      "expires_in": 3600,
      "token_type": "Bearer"
    },
    "headers": {},
    "status": 200
  }
}

We would use the access_token defined at {{.get_auth_token.body.access_token}} in subsequent requests.

HTTP Request Credential Options
HTTP Request Credential Options
HTTP Request Credential Location of token
HTTP Request Credential Location of token

We can now use another HTTP Request to make requests using the new credential. When the below action runs, it will first run the Get auth token credential in the background, extract the returned access_token and embed it in Authorization header, where the credential widget is defined:

{
  "url": "https://www.another-service.com/admin/login",
  "content_type": "json",
  "method": "get",
  "headers": {
    "Authorization": "Bearer {{ .CREDENTIAL.get_auth_token }}"
  }
}