Skip to content

Commit

Permalink
fix: 카카오 요청 관련 문제 해결 (#419)
Browse files Browse the repository at this point in the history
  • Loading branch information
JJ503 authored Sep 19, 2023
1 parent 8339f75 commit 66bb8ec
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
public class KakaoUserInformationProvider implements OAuth2UserInformationProvider {

private static final String TOKEN_TYPE = "Bearer ";
private static final String KAKAO_ADMIN_TOKEN_TYPE = "KakaoAK ";
private static final String REST_TEMPLATE_MESSAGE_SEPARATOR = ":";
private static final int MESSAGE_INDEX = 0;

Expand Down Expand Up @@ -60,14 +61,14 @@ public UserInformationDto findUserInformation(final String accessToken) {
@Override
public UserInformationDto unlinkUserBy(final String oauthId) {
final HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.set(HttpHeaders.AUTHORIZATION, TOKEN_TYPE + providersConfigurationProperties.adminKey());
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
headers.set(HttpHeaders.AUTHORIZATION, KAKAO_ADMIN_TOKEN_TYPE + providersConfigurationProperties.adminKey());

final MultiValueMap<String, String> parameters = new LinkedMultiValueMap<>();
parameters.add("target_id_type", "user_id");
parameters.add("target_id", oauthId);
final MultiValueMap<String, String> body = new LinkedMultiValueMap<>();
body.add("target_id_type", "user_id");
body.add("target_id", oauthId);

final HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(parameters, headers);
final HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(body, headers);

try {
final ResponseEntity<UserInformationDto> response = restTemplate.exchange(
Expand Down

0 comments on commit 66bb8ec

Please sign in to comment.