When using the hmac handlebar helper to generate an authentication header or URI parameter, integrator.io provides and populates a set of hmacOptions fields you can use to create the signature. hmacOptions is a JSON object that contains fields that are commonly used to create authentication signatures (such as the request body and the URI). The following table lists all available fields:
https://www.celigo-test.com/this/is/a/test?username=Integrator&domain=IO
Field name | Description |
hmacOptions.body |
The HTTP request body, in string format. |
hmacOptions.method |
The HTTP request method (verb). For example, PUT, POST, GET, etc. |
hmacOptions.http.encrypted |
The contents of the http.encrypted field from your HTTP connection. If you store the key in your HTTP connection as hmacKey, it is available for use as hmacOptions.http.encrypted.hmacKey. |
hmacOptions.baseURI |
The base URI used in the request. In this example, the value is: www.celigo-test.com |
hmacOptions.relativeURI |
The relative URI used in the request. In this example, the value is: /this/is/a/test |
hmacOptions.urlParameters* |
The URL parameters used in the request. In this example, the value is: username=Integrator&domain=IO |
hmacOptions.URI* |
The full URI used in the request. In this example, the value is: https://www.celigo-test.com/this/is/a/test?username=Integrator&domain=IO |
* Not available with authentication URL parameters.
Examples using hmacOptions with the hmac helper
To create an HMAC-SHA256 digest from the full URI in base64 format:
{{{hmac "sha256" hmacOptions.http.encrypted.hmacKey "base64" hmacOptions.URI}}}
To create an HMAC-SHA256 digest from the request body in hexadecimal format:
{{{hmac "sha256" hmacOptions.http.encrypted.hmacKey "hex" hmacOptions.body}}}
Comments
0 comments
Please sign in to leave a comment.