Skip to content

Commit

Permalink
refactor: (#121) 카카오 서버에 엑세스 토큰을 요청할 때 헤더 타입 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
jeomxon committed Jul 23, 2023
1 parent 5501220 commit c010bbf
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,16 @@ public String getAccessToken(final String code) {
info.remove("code");
info.add("code", code);

final OAuthAccessTokenResponse response = restTemplate.postForObject(
final HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);

final HttpEntity<MultiValueMap<String, String>> httpEntity = new HttpEntity<>(info, headers);

final OAuthAccessTokenResponse response = restTemplate.postForEntity(
"https://kauth.kakao.com/oauth/token",
info,
httpEntity,
OAuthAccessTokenResponse.class
);
).getBody();
return response.accessToken();
}

Expand Down

0 comments on commit c010bbf

Please sign in to comment.