Summary
The user is trying to create a connector using UI Builder for an API with a specific authentication method involving passing two HTTP headers. They are struggling to properly create the second header which requires a SHA-256 hash of a specific string. The issue arises from calling a macro within the authentication string.
Question
Hello there :octavia-wave:
I am trying to create a connector with the UI Builder for an API which uses a very specific authentication method, I need to pass two HTTP headers, as follows:
• One called Date
with a value of the current date in UTC (Universal Time Code) format (i.e. Tue, 16 Jan 2024 13:26:59 GMT);
• One called Authentication
with a value of the calculated authentication hash which is SHA-256 Hash in 64 character Hex format of the string “YourAPIToken:CurrentDateInUTCFormat:APIActionValue:YourAPISecret” (without quotes).
I’m thus trying to add these parameters in the request headers section of my streams. I’ve found for the first one that I can use the native macro "{{ now_utc() }}"
But now I really struggle to find a way to properly create the second header. I’ve made a lot of test iterations but here are the steps I followed to be the closest to what I’m trying to achieve:
• in the user inputs, I created an authentication_string
with the following content my_api_token:{{ now_utc() }}:my_api_action:my_api_secret
• in the request headers, I created a header with the key Authentication
• for this header’s value, I’m calling the following value: {{ config['authentication_string'] | hash('sha256') }}
However, the problem is that calling the macro "{{ now_utc() }}"
in this authentication string results in having the literal string "{{ now_utc() }}"
and not the macro’s expected result (i.e. the current date in UTC format).
Is there a proper way to achieve such an authentication ?
Thank you very much!
This topic has been created from a Slack thread to give it more visibility.
It will be on Read-Only mode here. Click here if you want to access the original thread.