Hello,

I am trying to create a FeignClient to access another Microservice. The MS is tied to an OAuth2 server as a resource. Unfortunately, no authentication headers are being forwarded to the MS and I am getting an unauthorized response code. Is there any workaround to use the FeignClient annotation to work with another MS with authentication requirements?

Here is the Feign Client class.

@FeignClient("DEPLOYMENT-SERVICE")
public interface DeploymentClient {
    @RequestMapping(method = RequestMethod.GET, value = "/v1/deployment/all")
    List<Map<?,?>> getAllDeployments();
}

Comment From: ryanjbaxter

You probably want to look into using a RequestInterceptor to add the OAuth token to the request. Here are 2 resources that might help. https://github.com/OpenFeign/feign https://jmnarloch.wordpress.com/2015/10/14/spring-cloud-feign-oauth2-authentication/

Comment From: bryantp

I've tried the interceptor before and I was having issues with Hystrix and Threading. I know I am supposed to change the isolation level to SEMAPHORE, but I am not sure how to do that.

Comment From: ryanjbaxter

Try setting hystrix.command.default.execution.isolation.strategy=SEMAPHORE

Comment From: bryantp

That did it. Thanks!

Comment From: Manaswini95

i have set the isolation strategy to semaphore,i still get interrupted exception when request interceptor is called with hystrix enabled,can someone help me on this