@PostMapping("/auth/kakao/accessToken")
@ResponseBody
public String getKakaoAccessToken(@RequestBody Map<String, String> paramMap) throws MalformedURLException, JsonProcessingException {
String code = paramMap.get("code");
String GOOGLE_TOKEN_REQUEST_URL = "https://kauth.kakao.com/oauth/token";
RestTemplate restTemplate=new RestTemplate();
Map<String, Object> params = new HashMap<>();
System.out.println("code = "+code);
params.put("code", code);
params.put("client_id", "*********");
//params.put("client_secret", "*********");
params.put("redirect_uri", "https://localhost:8081/auth/kakao/redirect");
params.put("grant_type", "authorization_code");
ResponseEntity<String> stringResponseEntity = restTemplate.postForEntity(GOOGLE_TOKEN_REQUEST_URL, params, String.class);
System.out.println(stringResponseEntity);
return stringResponseEntity.getBody();
}
현재 코드입니다.