HTTP Request - Persistent authorization token

Hello good people, I'm hoping for an assist here. I've been trying to get a flow working for some time now and keep hitting a road block. The goal is to be able to do a lookup on a separate REST service using 3 posts w/json which are; login, lookup, logoff. There is a random token in the headers, at least that is what I have identified with Postman code.

I have tried using a change node and a function node. Does anyone know a way to use a token with the request? I've seen it with hosting in tutorials but passing that token taken from the first call through the next two calls is proving a challenge.

The token is basically a cached session ID but is only referred to in headers.

if you are using the HTTP Request node.
you can supply a headers object.

  1. Store the header value from the resulting call (presumably login)

  2. Use the value later.

{
  "payload": {...},
  "method":"POST",
  "url": "yourURL",
  "headers": {
    "Content-Type": "application/json",
    "Header-Name": "Stored-Value"
  }
}

I've been able to separate out the session value into an object using the change node and yes it is definitely the HTTP request node. I'm assuming this would be used in a template node correct? I've not tried coding the json headers and body together I've just been using the change node for the headers. I'll work around with this and see what I can do. Thanks!

Alright, so the problem here is I don't know what the token will be until the login occurs. I want to automate this request in the flow so I don't have to manually input the token which expires after 2 minutes.

After you have done your login, store the token in global context using a change node.

image

Then later, you can call back into the stored global.

image

You can do this with functions nodes also. (my first example)

1 Like

Thanks for being so granular. I verified I am storing the token properly and it is coming across in the global as you described. I'm still getting a failure response from their service on the second request after login not being authenticated even with "keep-alive" enabled.

I'll re-verify what is being sent by my flow vs. the 3rd party requirement. Unfortunately I'm dealing with an IIS service.

I think I found it. The site is using a bearer token.

Well I stand corrected, I just tried manually injecting the login process, getting the session/token and then copied into the bearer token in the http request. I still get an authorization error so their service is quite frustrating.