크램폴린 환경에서 Spring oauth2 client 사용 시 문제

문의 시, 사용하시는 개발환경과 디벨로퍼스 앱ID를 알려주세요.


기술스택: Spring
앱 ID: 1152809

이게 로컬에서는 잘 동작하는데 크램폴린 내에서 배포를 하면 저런 에러가 떠서 로그인이 안되는데요.
현재 제 추측으로는 크램폴린 내의 백엔드 환경에서 외부 API를 사용할때는 프록시 서버를 이용해야하는데, 해당 도움말에서는 proxy 서버의 경우 https가 아닌 http 프로토콜로 적용해야 합니다. 라고 나와있는데, 하지만 kakao api는 https에서만 가능하지 않나요?? oauth2 client내에서 카카오에서 받은 code까지는 받아지는데, 백엔드 내부에서 카카오 API로 코드로 토큰받을때 안되는것같은데… 해당 프록시 만 이용해도 동작하나요?

https://krampoline-help.goorm.io/ide/kakao-cloud/dkos/proxy

2024-11-06T13:29:00.130+09:00 ERROR 1 — [nio-8080-exec-3] c.g.d.d.u.oauth2.CustomFailureHandler : Social login failure - Request URI: /api/login/oauth2/code/kakao, User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36, Erro
r: [invalid_request]
2024-11-06T13:29:00.543+09:00 ERROR 1 — [nio-8080-exec-4] c.g.d.d.u.oauth2.CustomFailureHandler : Social login failure - Request URI: /api/login/oauth2/code/kakao, User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36, Erro
r: [invalid_request]

안녕하세요.

인가요청 시, Spring Oauth2 에서 제공하는 auth 주소로 접근하셨나요? 아니면 JS SDK를 사용하셨나요?

spring oauth2 제공하는 auth 주소입니다
방금 실행해봤는데
2024-11-06T14:01:14.062+09:00 ERROR 1 — [io-8080-exec-10] c.g.d.d.u.oauth2.CustomFailureHandler : Social login failure - Request URI: /api/login/oauth2/code/kakao, User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148
Safari/604.1, Error: [invalid_token_response] An error occurred while attempting to retrieve the OAuth 2.0 Access Token Response: I/O error on POST request for “https://kauth.kakao.com/oauth/token”: Connection timed out
2024-11-06T14:01:14.062+09:00 ERROR 1 — [io-8080-exec-10] c.g.d.d.u.oauth2.CustomFailureHandler : Root cause: [invalid_token_response] An error occurred while attempting to retrieve the OAuth 2.0 Access Token Response: I/O error on POST request for “https://kauth.kakao.com/oauth/token”: Connection
timed out

이런 에러가 뜹니다

  1. 프론트에서
    https://k1ec344612739a.user-app.krampoline.com/api/oauth2/authorization/kakao 해당 링크로 a 태그로 들어가서 로그인

  2. https://kauth.kakao.com/oauth/authorize?response_type=code&client_id=0e2d82ca1274d3c102b162df9ef18a8f&scope=account_email%20profile_nickname%20profile_image&state=ia6cQhmFTL0K0swn0O8Di8_Wl7ljFdGFwJ3Ldq0vsr8%3D&redirect_uri=https://k1ec344612739a.user-app.krampoline.com/api/login/oauth2/code/kakao

여기 까진 잘 호출되는데

  1. https://k1ec344612739a.user-app.krampoline.com/api/login/oauth2/code/kakao?code=F_Mk5IS1X1N_OAHgkD2dsaBr8WRS_bv9Fgtw7TxQ4ef7vqHGUXvIyQAAAAQKKwyoAAABkv_XKkwWphHJzwXJqw&state=ia6cQhmFTL0K0swn0O8Di8_Wl7ljFdGFwJ3Ldq0vsr8%3D
    여기서 계속 요청중이다가 꽤 지나면 504 Gateway Timeout 뜨는 구조입니다

제 생각엔 크램폴린 환경상에서는 동작하는 백엔드 서버에서 외부로 api를 호출할때는 프록시 서버를 이용해야하는데,
해당 크램폴린 프록시는 http 만 지원하는데, 카카오 api는 https만 지원해서. 안되는걸까요? 만약에 그렇다면 크램폴린 프록시서버가 https를 지원을 하지 않으면 방법이 없는건가요?
프록시 설정을 했음에도 안되서, 제가 프록시설정을 잘못한거일까요??

이 부분은 관련 없어 보입니다.
프록시로 사용될 주소가 http 로 시작하는 주소일 뿐 카카오측 호출하기 위한 요청은 https 로 시작되는 주소를 사용하셔야 합니다.

504 오류는 카카오측 응답이 아니기에
proxy를 통해 api요청되지 않는 것으로 보이는데요 spring 에서 카카오측 호출하실 때 프록시 설정은 어떻게 하셨나요?

@Configuration
public class OAuth2Config {

    @Bean
    public RestTemplate proxyRestTemplate() {
        SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();

        // Krampoline 프록시 서버 설정
        Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("krmp-proxy.9rum.cc", 3128));
        requestFactory.setProxy(proxy);

        return new RestTemplate(requestFactory);
    }
}
public class CustomOAuth2UserService extends DefaultOAuth2UserService {
    private final UserRepository userRepository;
    private final RestTemplate proxyRestTemplate;

    @PostConstruct
    public void init() {
        this.setRestOperations(proxyRestTemplate);
    }

이런식으로 spring oauth2 client Oauth2Service 에서 프록시 설정을 주입받았는데 프록시설정이 제대로 안되서 안됐나봐요?

달리 문제 없어보이는데요
생성자 주입 방식으로 변경 후, 테스트해보시겠어요?

해당 코드는 사용자 정보요청때만 프록시 설정이 되는 코드여서 액세스토큰 요청시에도 프록시를 적용하기위해

@Configuration
public class OAuth2Config {

    @Bean
    public RestTemplate oAuthRestTemplate() {
        SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();

        Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("krmp-proxy.9rum.cc", 3128));
        requestFactory.setProxy(proxy);

        RestTemplate restTemplate = new RestTemplate(requestFactory);

        // 로깅 인터셉터 추가
        restTemplate.getInterceptors().add(new LoggingRequestInterceptor());

        return restTemplate;
    }

    // Spring Security OAuth2 클라이언트가 액세스 토큰을 요청할 때 프록시 설정 등 커스텀 RestTemplate 설정을 적용
    @Bean
    public OAuth2AccessTokenResponseClient<OAuth2AuthorizationCodeGrantRequest> oAuth2AccessTokenResponseClient(
            RestTemplate oAuthRestTemplate) {
        DefaultAuthorizationCodeTokenResponseClient client = new DefaultAuthorizationCodeTokenResponseClient();
        client.setRestOperations(oAuthRestTemplate);
        return client;
    }
}
@Service
@Slf4j
@RequiredArgsConstructor
@Transactional(readOnly = true)
public class CustomOAuth2UserService implements OAuth2UserService<OAuth2UserRequest, OAuth2User> {
    private final UserRepository userRepository;
    private final RestTemplate oAuthRestTemplate;

    private DefaultOAuth2UserService delegate = new DefaultOAuth2UserService();

    @PostConstruct
    public void init() {
        delegate.setRestOperations(oAuthRestTemplate);
    }

    @Transactional
    @Override
    public OAuth2User loadUser(OAuth2UserRequest userRequest) throws OAuth2AuthenticationException {
        OAuth2User oAuth2User = delegate.loadUser(userRequest);
        String registrationId = userRequest.getClientRegistration().getRegistrationId();
        if (registrationId == null) {
            throw new OAuth2AuthenticationException("유효하지않는 OAuth2 제공자입니다.");
        }
        OAuth2Response oAuth2Response = new KaKaoResponse(oAuth2User.getAttributes());

        User user = findOrCreateMember(oAuth2Response, registrationId);
        return new CustomUserDetails(user, oAuth2User.getAttributes());
    }
                .oauth2Login(oauth2 -> oauth2
                        .tokenEndpoint(tokenEndpointConfig -> tokenEndpointConfig
                                .accessTokenResponseClient(oAuth2AccessTokenResponseClient)
                        )
                        .userInfoEndpoint(userInfoEndpointConfig -> userInfoEndpointConfig
                                .userService(customOAuth2UserService)
                        )
                        .authorizationEndpoint(authorization -> authorization
                                .authorizationRequestRepository(httpCookieOAuth2AuthorizationRequestRepository)
                        )
                        .successHandler(customSuccessHandler)
                        .failureHandler(customFailureHandler)
                )

이렇게 실행했더니,

2024-11-06T16:09:27.246+09:00 DEBUG 1 --- [nio-8080-exec-6] o.s.web.client.RestTemplate              : HTTP POST https://kauth.kakao.com/oauth/token
2024-11-06T16:09:27.310+09:00 DEBUG 1 --- [nio-8080-exec-6] o.s.web.client.RestTemplate              : Accept=[application/json, application/*+json]
2024-11-06T16:09:27.312+09:00 DEBUG 1 --- [nio-8080-exec-6] o.s.web.client.RestTemplate              : Writing [{grant_type=[authorization_code], code=[IAIBAiazzAscc_5lVAfKXID7tK2rVFJgXOwI24cerfk4N_CP39CVqwAAAAQKPCKbAAABkwBOiQsp9hBbJybEWQ], redirect_uri=[https://k1ec344612739a.user-app.krampoline.com/ap
i/login/oauth2/code/kakao], client_id=[0e2d82ca1274d3c102b162df9ef18a8f], client_secret=[ejUps9a8s1ombRsCeM2XkFuxNuO8LJrn]}] as "application/x-www-form-urlencoded;charset=UTF-8"
2024-11-06T16:09:27.694+09:00 DEBUG 1 --- [nio-8080-exec-6] o.s.web.client.RestTemplate              : Response 200 OK
2024-11-06T16:09:27.696+09:00 DEBUG 1 --- [nio-8080-exec-6] o.s.web.client.RestTemplate              : Reading to [org.springframework.security.oauth2.core.endpoint.OAuth2AccessTokenResponse]
2024-11-06T16:09:27.711+09:00 ERROR 1 --- [nio-8080-exec-6] o.a.c.c.C.[.[.[.[dispatcherServlet]      : Servlet.service() for servlet [dispatcherServlet] in context with path [/api] threw exception

java.lang.IllegalArgumentException: accessToken cannot be null
        at org.springframework.util.Assert.notNull(Assert.java:172) ~[spring-core-6.1.14.jar!/:6.1.14]
        at org.springframework.security.oauth2.client.authentication.OAuth2AuthorizationCodeAuthenticationToken.<init>(OAuth2AuthorizationCodeAuthenticationToken.java:103) ~[spring-security-oauth2-client-6.3.4.jar!/:6.3.4]
        at org.springframework.security.oauth2.client.authentication.OAuth2AuthorizationCodeAuthenticationProvider.authenticate(OAuth2AuthorizationCodeAuthenticationProvider.java:91) ~[spring-security-oauth2-client-6.3.4.jar!/:6.3.4]
        at org.springframework.security.oauth2.client.authentication.OAuth2LoginAuthenticationProvider.authenticate(OAuth2LoginAuthenticationProvider.java:109) ~[spring-security-oauth2-client-6.3.4.jar!/:6.3.4]
        at org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:182) ~[spring-security-core-6.3.4.jar!/:6.3.4]

이런식으로 뜹니다!

서비스 인가코드 주소로 확인해본 결과
카카오 로그인 후, 접근토큰 발급은 성공하였지만 이후 사용자 정보 가져오기 이력이 확인되지 않습니다.

위의 테스트 시간대에 오류 발생 로그를 확인 부탁드립니다.

Spring 에서 카카오에서 받은 응답 바디를 파싱을 못해서 커스텀 컨버터를 만들어서 해결했습니다. 감사합니다!

2024-11-06T18:53:18.641+09:00 DEBUG 1 --- [nio-8080-exec-2] o.s.web.client.RestTemplate              : HTTP POST https://kauth.kakao.com/oauth/token
2024-11-06T18:53:18.642+09:00 DEBUG 1 --- [nio-8080-exec-2] o.s.web.client.RestTemplate              : Accept=[application/json, application/*+json]
2024-11-06T18:53:18.642+09:00 DEBUG 1 --- [nio-8080-exec-2] o.s.web.client.RestTemplate              : Writing [{grant_type=[authorization_code], code=[nGrEGzz-UWfaGdR0y-h0CXlOTeRrVHZLNhZbLK8P_uN4W6ooB3r92QAAAAQKKw0fAAABkwDkjRW2xj-RG-1vuA], redirect_uri=[https://k1ec344612739a.user-app.krampoline.
com/api/login/oauth2/code/kakao], client_id=[0e2d82ca1274d3c102b162df9ef18a8f], client_secret=[ejUps9a8s1ombRsCeM2XkFuxNuO8LJrn, ejUps9a8s1ombRsCeM2XkFuxNuO8LJrn]}] as "application/x-www-form-urlencoded;charset=UTF-8"
2024-11-06T18:53:18.642+09:00 DEBUG 1 --- [nio-8080-exec-2] c.g.d.c.f.LoggingRequestInterceptor      : ===== Request Begin =====
2024-11-06T18:53:18.642+09:00 DEBUG 1 --- [nio-8080-exec-2] c.g.d.c.f.LoggingRequestInterceptor      : URI         : https://kauth.kakao.com/oauth/token
2024-11-06T18:53:18.643+09:00 DEBUG 1 --- [nio-8080-exec-2] c.g.d.c.f.LoggingRequestInterceptor      : Method      : POST
2024-11-06T18:53:18.643+09:00 DEBUG 1 --- [nio-8080-exec-2] c.g.d.c.f.LoggingRequestInterceptor      : Headers     : [Accept:"application/json;charset=UTF-8", Content-Type:"application/x-www-form-urlencoded;charset=UTF-8", Content-Length:"362"]
2024-11-06T18:53:18.643+09:00 DEBUG 1 --- [nio-8080-exec-2] c.g.d.c.f.LoggingRequestInterceptor      : Request body: grant_type=authorization_code&code=nGrEGzz-UWfaGdR0y-h0CXlOTeRrVHZLNhZbLK8P_uN4W6ooB3r92QAAAAQKKw0fAAABkwDkjRW2xj-RG-1vuA&redirect_uri=https%3A%2F%2Fk1ec344612739a.user-app.krampoli
ne.com%2Fapi%2Flogin%2Foauth2%2Fcode%2Fkakao&client_id=0e2d82ca1274d3c102b162df9ef18a8f&client_secret=ejUps9a8s1ombRsCeM2XkFuxNuO8LJrn&client_secret=ejUps9a8s1ombRsCeM2XkFuxNuO8LJrn
2024-11-06T18:53:18.643+09:00 DEBUG 1 --- [nio-8080-exec-2] c.g.d.c.f.LoggingRequestInterceptor      : ===== Request End =====
2024-11-06T18:53:18.694+09:00 DEBUG 1 --- [nio-8080-exec-2] c.g.d.c.f.LoggingRequestInterceptor      : ===== Response Begin =====
2024-11-06T18:53:18.695+09:00 DEBUG 1 --- [nio-8080-exec-2] c.g.d.c.f.LoggingRequestInterceptor      : Status code  : 200 OK
2024-11-06T18:53:18.695+09:00 DEBUG 1 --- [nio-8080-exec-2] c.g.d.c.f.LoggingRequestInterceptor      : Status text  : OK
2024-11-06T18:53:18.696+09:00 DEBUG 1 --- [nio-8080-exec-2] c.g.d.c.f.LoggingRequestInterceptor      : Headers      : [Date:"Wed, 06 Nov 2024 09:53:18 GMT", Content-Type:"application/json;charset=utf-8", Transfer-Encoding:"chunked", Connection:"keep-alive", Cache-Control:"no-cache, no-store, max-a
ge=0, must-revalidate", Pragma:"no-cache", Expires:"0", X-XSS-Protection:"1; mode=block", X-Frame-Options:"DENY", X-Content-Type-Options:"nosniff", Kakao:"Talk", Access-Control-Allow-Origin:"*", Access-Control-Allow-Methods:"GET, POST, OPTIONS", Access-Control-Allow-Headers:"Authorization, KA, Ori
gin, X-Requested-With, Content-Type, Accept"]
2024-11-06T18:53:18.696+09:00 DEBUG 1 --- [nio-8080-exec-2] c.g.d.c.f.LoggingRequestInterceptor      : Response body: {"access_token":"ktG6F_T9oUC_SlOlwg8DrJl9ZgyFVtxfAAAAAQo9c5sAAAGTAOSNX9Q0RDl69jWm","token_type":"bearer","refresh_token":"I5rtimzdr2cqmBhaEGso5VMR-zc-IQUPAAAAAgo9c5sAAAGTAOSNW9Q0RD
l69jWm","expires_in":21599,"scope":"account_email profile_image profile_nickname","refresh_token_expires_in":5183999}
2024-11-06T18:53:18.696+09:00 DEBUG 1 --- [nio-8080-exec-2] c.g.d.c.f.LoggingRequestInterceptor      : ===== Response End =====
2024-11-06T18:53:18.697+09:00 DEBUG 1 --- [nio-8080-exec-2] o.s.web.client.RestTemplate              : Response 200 OK
2024-11-06T18:53:18.697+09:00 DEBUG 1 --- [nio-8080-exec-2] o.s.web.client.RestTemplate              : Reading to [java.util.Map<java.lang.String, java.lang.Object>]
2024-11-06T18:53:18.704+09:00 DEBUG 1 --- [nio-8080-exec-2] o.s.web.client.RestTemplate              : HTTP GET https://kapi.kakao.com/v2/user/me
2024-11-06T18:53:18.705+09:00 DEBUG 1 --- [nio-8080-exec-2] o.s.web.client.RestTemplate              : Accept=[application/json, application/*+json]
2024-11-06T18:53:18.706+09:00 DEBUG 1 --- [nio-8080-exec-2] c.g.d.c.f.LoggingRequestInterceptor      : ===== Request Begin =====
2024-11-06T18:53:18.706+09:00 DEBUG 1 --- [nio-8080-exec-2] c.g.d.c.f.LoggingRequestInterceptor      : URI         : https://kapi.kakao.com/v2/user/me
2024-11-06T18:53:18.706+09:00 DEBUG 1 --- [nio-8080-exec-2] c.g.d.c.f.LoggingRequestInterceptor      : Method      : GET
2024-11-06T18:53:18.706+09:00 DEBUG 1 --- [nio-8080-exec-2] c.g.d.c.f.LoggingRequestInterceptor      : Headers     : [Accept:"application/json", Authorization:"Bearer ktG6F_T9oUC_SlOlwg8DrJl9ZgyFVtxfAAAAAQo9c5sAAAGTAOSNX9Q0RDl69jWm", Content-Length:"0"]
2024-11-06T18:53:18.707+09:00 DEBUG 1 --- [nio-8080-exec-2] c.g.d.c.f.LoggingRequestInterceptor      : Request body:
2024-11-06T18:53:18.707+09:00 DEBUG 1 --- [nio-8080-exec-2] c.g.d.c.f.LoggingRequestInterceptor      : ===== Request End =====
2024-11-06T18:53:18.712+09:00 ERROR 1 --- [nio-8080-exec-2] c.g.d.d.u.oauth2.CustomFailureHandler    : Social login failure - Request URI: /api/login/oauth2/code/kakao, User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/1
5E148 Safari/604.1, Error: [invalid_user_info_response] An error occurred while attempting to retrieve the UserInfo Resource: I/O error on GET request for "https://kapi.kakao.com/v2/user/me": Unable to tunnel through proxy. Proxy returns "HTTP/1.1 503 Service Unavailable"
2024-11-06T18:53:18.712+09:00 ERROR 1 --- [nio-8080-exec-2] c.g.d.d.u.oauth2.CustomFailureHandler    : Root cause: I/O error on GET request for "https://kapi.kakao.com/v2/user/me": Unable to tunnel through proxy. Proxy returns "HTTP/1.1 503 Service Unavailable"

자꾸 사용자 정보 api 호출때 에러가 뜨네요. 혹시 이유를 알 수 있을까요

@Configuration
public class OAuth2Config {

    @Bean
    public RestTemplate oAuthRestTemplate() {
        SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();

        Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("krmp-proxy.9rum.cc", 3128));
        requestFactory.setProxy(proxy);

        RestTemplate restTemplate = new RestTemplate(requestFactory);

        // 로깅 인터셉터 추가
        restTemplate.getInterceptors().add(new LoggingRequestInterceptor());

        return restTemplate;
    }

    // Spring Security OAuth2 클라이언트가 액세스 토큰을 요청할 때 프록시 설정 등 커스텀 RestTemplate 설정을 적용
    @Bean
    public OAuth2AccessTokenResponseClient<OAuth2AuthorizationCodeGrantRequest> oAuth2AccessTokenResponseClient(
            RestTemplate oAuthRestTemplate) {
        return new CustomAuthorizationCodeTokenResponseClient(oAuthRestTemplate);
    }
}
@Service
@Slf4j
@RequiredArgsConstructor
@Transactional(readOnly = true)
public class CustomOAuth2UserService extends DefaultOAuth2UserService {
    private final UserRepository userRepository;
    private final RestTemplate oAuthRestTemplate;

    @PostConstruct
    public void init() {
        this.setRestOperations(oAuthRestTemplate);
    }

    @Transactional
    @Override
    public OAuth2User loadUser(OAuth2UserRequest userRequest) throws OAuth2AuthenticationException {
        OAuth2User oAuth2User = super.loadUser(userRequest);
        String registrationId = userRequest.getClientRegistration().getRegistrationId();
        if (registrationId == null) {
            throw new OAuth2AuthenticationException("유효하지않는 OAuth2 제공자입니다.");
        }
        OAuth2Response oAuth2Response = new KaKaoResponse(oAuth2User.getAttributes());

        User user = findOrCreateMember(oAuth2Response, registrationId);
        return new CustomUserDetails(user, oAuth2User.getAttributes());
    }
public class CustomAuthorizationCodeTokenResponseClient implements
        OAuth2AccessTokenResponseClient<OAuth2AuthorizationCodeGrantRequest> {

    private RestOperations restOperations;
    private Converter<OAuth2AuthorizationCodeGrantRequest, RequestEntity<?>> requestEntityConverter = new CustomAuthorizationCodeGrantRequestEntityConverter();

    public CustomAuthorizationCodeTokenResponseClient(RestOperations restOperations) {
        this.restOperations = restOperations;
    }

    @Override
    public OAuth2AccessTokenResponse getTokenResponse(OAuth2AuthorizationCodeGrantRequest authorizationGrantRequest) {
        Assert.notNull(authorizationGrantRequest, "authorizationGrantRequest cannot be null");

        // 올바른 컨버터 사용
        RequestEntity<?> request = requestEntityConverter.convert(authorizationGrantRequest);

        ResponseEntity<Map<String, Object>> response = restOperations.exchange(
                request, new ParameterizedTypeReference<Map<String, Object>>() {
                });

        Map<String, Object> tokenResponseParameters = response.getBody();

        return this.convertToOAuth2AccessTokenResponse(tokenResponseParameters);
    }
 .oauth2Login(oauth2 -> oauth2
                        .tokenEndpoint(tokenEndpointConfig -> tokenEndpointConfig
                                .accessTokenResponseClient(oAuth2AccessTokenResponseClient)
                        )
                        .userInfoEndpoint(userInfoEndpointConfig -> userInfoEndpointConfig
                                .userService(customOAuth2UserService)
                        )
                        .authorizationEndpoint(authorization -> authorization
                                .authorizationRequestRepository(httpCookieOAuth2AuthorizationRequestRepository)
                        )
                        .successHandler(customSuccessHandler)
                        .failureHandler(customFailureHandler)
                )

안녕하세요.

Unable to tunnel through proxy. Proxy returns “HTTP/1.1 503 Service Unavailable”

운영하시는 환경에서 프록시를 통해 kapi 서버 연결하는데 문제가 있는 상황으로 보입니다.
kapi를 호출하지 못한 상황이므로 자세한 내용은 크램폴린 담당자에게 문의 해보시면 좋을 것 같습니다.

kauth는 호출하고 kapi는 호출하지 못하는 것으로 볼때 코드에는 문제가 없고, 단순 환경 설정 문제로 추정됩니다.

네 kapi가 간헐적으로 요청이 실패하는거네요… 프록시 서버 문제인것같습니다

kapi도 간헐적 성공한다면,
프록시 통해 아래 IP 접속 가능하도록 되어 있는지도 확인 요청 해보시면 좋을 것 같아요.

  • https://kauth.kakao.com : 주로 OAuth2 인증 토큰 발급 및 제3자 정보제공 동의시에 사용되는 도메인입니다.
    203.133.166.32
    27.0.237.15
  • https://kapi.kakao.com : 토큰을 획득한 후 사용자 정보 또는 기타 API를 사용하기 위한 도메인입니다.
    203.133.166.33
    211.249.200.134

카카오 로그인 등 카카오 api를 위한 방화벽 허용

1개의 좋아요