I’m trying to implement a form that calls after user input some API via a flow. I would perform this call with a HTTP Connection within the flow then.
But when setting up HTTP Connections, I need to configure a Bearer Token globally at the connection level once. This seems confusing, as tokens don’t have an unlimited lifetime and so they certainly get invalidated at some point for this connection.
I though that I could just define the token in the HTTP call itself by setting an Authorization header that overwrites the token originally defined for the connection but that doesn’t seem to work.
My workaround was now to stop the flow before the call and instead have another action in the trigger after this action finished which does a standard fetch-call. Not as convenient but so I can set the Authorization header how I need it (e.g. generating a M2M token on the fly and then calling our API with it).
Do I get something wrong here? Or what is the supposed use case of the HTTP connection within flows?
Regarding the issue that you are having with the HTTP request flow, indeed, whenever you need to make an API call using a bearer token header which unfortunately expires, you cannot dynamically update the value directly without using a shared or context variable.
In order for the flow to run correctly, I would recommend making an API call in the flow first which will fetch the API token and then use that token in the HTTP request to your API. This way, you should be able to use the result of the first API call ( the api token) and declare it as a variable inside the second HTTP flow.