Defining Variables for Custom Authentication

Hello,

When setting up custom authentication to a REST API, there is the ability to “Define a variable”. In the example text of “Value of the variable” there is the text “{{ http1.body.auth_token }}”. Can anyone tell me what the object “http1” is? What properties does it have? I would specifically like to access the request method and request path. I am assuming that “http1” is the request object before the request has been made. Is this correct?

I am working with an API that requires me to create a SHA265 signature of the request body, current timestamp and a secret before sending the request. I am hoping I can do this by defining a variable that calculates this signature in the custom authentication workflow.

Additionally, it would be great to be able to define a transformer and run it as part of the custom authentication scheme.

Thank you,

FMS

it means the first http query.
add more steps, you will find that first step exports to http1, second step exports to http2

2 Likes

Hi FMS,

Welcome to the Retool community!

In addition to what tRYxzrXq said, you can find more details on custom authentications here:

I would think you’ll probably have to put your code that does the SHA256 etc. calculation in a separate web service and call it using the API Request step. You could then reference this in the way you mentioned from the httpN.body.

It may be possible to write some code in-line in the variable step but I’d have to test it and you wouldn’t be able to import any other libraries.

Thanks for the feedback about adding transformers into these steps. I’ll pass that on.

Chris Smith
Developer Advocate