Skip to main content

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?

 

 

 

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


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.


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


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. 


 


 


Hi All,

 I ran into the same problem as described above. The Solution for me was to create the Authentication component of the request within the Web Connections. The http caller is then configured wihin the workflow configured with authentication checked and the body of the post having the file or packet I needed to send. This has worked for our MS Dynamics environment. 

Documentation as follows FME Options: Web Connections