title: Autherization service is not responsding with access_token while using zuul gateway
body: <p>I created multiple microservices with springboot 1.4. Last week I decided to implement oauth2 authorization service. My plan is something like,</p>
  
  <ol>
  <li><p>Every request should be handled by zuul gateway which is registered by Eureka.</p></li>
  <li><p>So the new Authorization service will be called by eureka to get access_token.</p></li>
  </ol>
  
  <p>The problem I found is that I can able to get JWT access token directly from authorization server which is running in an another port(8081). when I tried to get the jwt token via zuul gateway, unfortunately I am getting an empty string.</p>
  
  <p>Please take a look at my gateway configuration</p>
  
  <p>application.yml (zuul-gateway)</p>
  
  <pre><code> zuul:
     routes: 
      static:
      path: /static/** 
     uaa:
      path: /uaa/**
      sensitive-headers: 
      serviceId: microservice-security-oauth2-server
     users:
      path: /users/**
      serviceId: microservice-core-user
  
  
  
  security:
   basic:
    enabled: false
  </code></pre>
  
  <p>application class of zuul is</p>
  
  <pre><code> @SpringBootApplication
   @EnableZuulProxy
   @EnableEurekaClient
   @ComponentScan(basePackages={"com.configuration","com.zullfilter"})
   public class ZullGatewayServerApplication {
  
      public static void main(String[] args) {
        SpringApplication.run(ZullGatewayServerApplication.class, args);
      }
  
  }
  </code></pre>
  
  <p>and the authorization server configuration class is</p>
  
  <pre><code>   @Configuration
     @EnableAuthorizationServer
     public class OAuth2AuthorizationConfiguration extends  AuthorizationServerConfigurerAdapter {
  
  @Autowired
  private AuthenticationManager authenticationManager;
  
  @Autowired
  private Environment environment;
  
  @Override
  public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
      endpoints.tokenStore(tokenStore())
              .tokenEnhancer(jwtTokenEnhancer())
              .authenticationManager(authenticationManager);
  }
  
  @Override
  public void configure(AuthorizationServerSecurityConfigurer security) throws Exception {
      security.tokenKeyAccess("permitAll()")
              .checkTokenAccess("isAuthenticated()");
  }
  
  @Bean
  public TokenStore tokenStore() {
      return new JwtTokenStore(jwtTokenEnhancer());
  }
  
  @Bean
  protected JwtAccessTokenConverter jwtTokenEnhancer() {
      String pwd = environment.getProperty("keystore.password");
      KeyStoreKeyFactory keyStoreKeyFactory = new KeyStoreKeyFactory(
              new ClassPathResource("jwt.jks"),
              pwd.toCharArray());
      JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
      converter.setKeyPair(keyStoreKeyFactory.getKeyPair("jwt"));
      return converter;
  }
  
  @Override
  public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
      clients.inMemory()
              .withClient("service-account-1")
              .secret("service-account-1-secret")
              .authorizedGrantTypes("client_credentials")
              .scopes("resource-server-read", "resource-server-write")
              .accessTokenValiditySeconds(6000);
   }
  }
  </code></pre>
  
  <p>I am getting access_token requesting directly to </p>
  
  <pre><code> curl service-account-1:service-account-1-secret@localhost:8081/uaa/oauth/token -d grant_type=client_credentials
  </code></pre>
  
  <p>but when I am trying this with zuul proxy then I am getting an empty string</p>
  
  <pre><code> curl service-account-1:service-account-1-secret@localhost:8765/uaa/oauth/token -d grant_type=client_credentials
  </code></pre>
  
  <p>I am using zuul gateway version of 1.3
  and spring boot 1.4</p>
  
  <p>if anybody have faced this issue before please let me know</p>