1

I have a spring boot application which is trying to contact Github for OAuth. In open internet, everything works fine. But behind a corporate proxy I get a Authentication Failed: Could not obtain access token error during the callback stage. How can I set the relevant proxy details to get my setup working?

The below is my application.yml file:

security:
      oauth2:
        client:     
            clientId: xxx
            clientSecret: yyy
            accessTokenUri: https://github.com/login/oauth/access_token
            userAuthorizationUri: https://github.com/login/oauth/authorize
            clientAuthenticationScheme: form

        resource:
          userInfoUri: https://api.github.com/user
          preferTokenInfo: false

This is my application:

@SpringBootApplication
@RestController
@EnableOAuth2Sso
public class SecurityDemoApplication {

    public static void main(String[] args) {
        SpringApplication.run(SecurityDemoApplication.class, args);
    }

    @RequestMapping("/hello")
    public String hello() {
        return "Hello World";
    }

}

I tried setting the JVM parameters: -Dhttp.proxyHost=foo -Dhttp.proxyPort=80 also. But it did not have any effect.

codingsplash
  • 4,785
  • 12
  • 51
  • 90
  • https://stackoverflow.com/questions/37854133/how-to-set-proxy-on-spring-oauth2-oauth2accesstoken-request-or-how-to-override-o – StanislavL Dec 08 '17 at 07:28

0 Answers0