title: Spring cloud Feign OAuth2 request interceptor is not working
body: <p>I am trying to create a simple REST client using spring cloud feign to consume a service which is secured with OAuth2 security tokens. I am using OAuth2FeignRequestInterceptor for adding the bearer token, check my below code. I am facing 401. and when try to debug my code I don't find the bearer token in my Request object.</p>
  
  <pre><code>@Configuration
  @EnableConfigurationProperties(value=OAuth2ClientCredentialsProperties.class)
  @EnableOAuth2Client
  @Profile(OAuth2Profiles.CLIENT_CREDENTIALS)
  public class ClientCredentialsConfiguration {
  
      @Autowired
      private OAuth2ClientCredentialsProperties oAuth2ClientCredentialsProperties;
  
      @Bean
      @Qualifier("ClientCredentialsOAuth2FeignRequestInterceptor")
      public OAuth2FeignRequestInterceptor oauth2schemeRequestInterceptor() {
          return new OAuth2FeignRequestInterceptor(new DefaultOAuth2ClientContext(), oauth2schemeResourceDetails());
      }
  
      @Bean
      public ClientCredentialsResourceDetails oauth2schemeResourceDetails() {
          ClientCredentialsResourceDetails details = new ClientCredentialsResourceDetails();
          details.setClientId(oAuth2ClientCredentialsProperties.getClientId());
          details.setClientSecret(oAuth2ClientCredentialsProperties.getClientSecret());
          details.setAccessTokenUri(oAuth2ClientCredentialsProperties.getAccessTokenUri());
          details.setScope(oAuth2ClientCredentialsProperties.getScopes());
          return details;
      }
  
  }
  </code></pre>
  
  <p>Here is my client interface</p>
  
  <pre><code>@FeignClient(name = "test", url = "http://localhost:8080", configuration = ClientCredentialsConfiguration.class)
  interface GitHubClient {
  
  
      @RequestMapping(value = "/api/v1/products",
              produces = "application/json",
              consumes = "application/json;charset=UTF-8",
              method = RequestMethod.POST)
      ResponseEntity&lt;Object&gt; testUsingPOST(@RequestBody TestDTO testDTO);
  </code></pre>
  
  <p>and my properties are below</p>
  
  <pre><code>server.port=10080
  
  security.user.name=admin
  security.user.password=admin
  security.basic.enabled=false
  
  org.springframework.boot.autoconfigure.EnableAutoConfiguration=sgcib.clips.bcsapi.configuration.ClientCredentialsConfiguration
  
  feign.oauth2.enabled=true
  
  feign.hystrix.enabled=false
  </code></pre>
  
  <p>My Main class</p>
  
  <pre><code>@SpringBootApplication
  @EnableWebMvc
  @Controller
  @EnableFeignClients
  @EnableAutoConfiguration
  public class App extends SpringBootServletInitializer {
  
  
      @Autowired
      private GitHubClient gitHub;
  
      @RequestMapping("/")
      public String home() {
          return "index";
      }
  
      @RequestMapping("/{owner}")
      @ResponseBody
      public ResponseEntity&lt;Object&gt; contributors(@PathVariable String owner) {
          return gitHub.productsUsingPOST(new TestDTO());
      }
  
      public static void main(String[] args) {
          SpringApplication.run(App.class, args);
      }
  </code></pre>