Skip to main content
Question

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

  • February 7, 2023
  • 5 replies
  • 146 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

Forum|alt.badge.img
  • February 7, 2023

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


david_r
Celebrity
  • February 7, 2023

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.


ebygomm
Influencer
Forum|alt.badge.img+39
  • Influencer
  • February 7, 2023
sal wrote:

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


  • Author
  • February 7, 2023
ebygomm wrote:

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


marcuspatam
Participant
Forum|alt.badge.img+2
  • Participant
  • March 17, 2024

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. 


 


 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings