I have a service that gets http request with an authorization header. When processing the request, I want to use a Feign Client to query another service. The query to the other service should include the different authorization header.
You simple pass your header as an argument and you declare your method in your interface accordingly. Please find snippet of code below.
And when you run your Feign client with logging level full (feign.client.config.default.loggerLevel=full), you'll see the authorization header (being an OAuth Bearer access token in my case).
Hopefully this helps.
All the best, Wim
@FeignClient(name="mde", url="${MDE.campaignServiceEndpoint}")
public interface CampaignClientService {
@RequestMapping(method = RequestMethod.GET, value = "/useCases/search/findByName?name={name}")
@Cacheable("placementUseCase")
PlacementUseCase findUseCaseByName(@RequestHeader(value = "Authorization", required = true) String authorizationHeader, @PathVariable("name") String name);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With