Question

(FME 2020.0) HTTP Caller header does not work when giving it a FME Attribute

  • 7 February 2023
  • 5 replies
  • 32 views

Hey,

 

I am trying to create a workspace with a HTTP Caller, that needs a Bearer token.

 

I use an earlier HTTP Caller to obtain the Bearer token with a login call. This is put into an attribute, which I then edit to add the phrase "bearer" infront of.

 

After which I want to use this attribute as a header in the next HTTP Caller to do the call I'm interested it.

 

This does not work, It gives me a error 401 Unauthorized, but if I copy and paste the bearer token into the header manually, it works.

 

Anyone any idea why this happens?

 

 

 


5 replies

Badge

Hey, When you are specifying a token in the headers, try something like this:imageYou can insert your token value at @Value(_response_body)

Userlevel 4

Also make sure to inspect the value of the "apiKey" attribute just before it enters the HTTPCaller, making sure that it does indeed have the "bearer " prefix.

Userlevel 1
Badge +10

Hey, When you are specifying a token in the headers, try something like this:imageYou can insert your token value at @Value(_response_body)

This is the approach I use and this works fine in FME 2020

image

This is the approach I use and this works fine in FME 2020

image

Unfortunately neither of these seem to solve the problem. What I'm failing to understand is why it works when the "bearer <key>" are explicitly put into the header as opposed to defined as an attribute. (I have also tried putting Bearer into the attribute itself vs outside the attribute)ss1image

Badge +1

Hey, I ran into the same problem as you.

I had another endpoint that needs to run to get this token.

The way I did it to get that token into the header is to run a StringConcatenator first , then use it in the HTTPCaller as an attribute.


Hope this helps!

Here , response_body is my token that goes with the “Bearer XX” value in the Authorization header. 


 


 

Reply