안녕하세요.
/v1/user/me 사용자 정보 요청 Rest API 호출 시, 아래와 같은 오류가 발생합니다.
POST로 요청시, 405 Not Allowed
GET으로 요청시, 404 Not Found
인증서 문제일까요?
답변부탁드립니다.
감사합니다.
안녕하세요.
/v1/user/me 사용자 정보 요청 Rest API 호출 시, 아래와 같은 오류가 발생합니다.
POST로 요청시, 405 Not Allowed
GET으로 요청시, 404 Not Found
인증서 문제일까요?
답변부탁드립니다.
감사합니다.
@anon37646735
해결되신거죠?
아닙니다.
아직 해결하지 못했습니다.ㅜㅜ
@anon37646735
해결된 줄 알았습니다. ㅠ
안되는 코드를 공유 해주시면 확인해 보겠습니다.
내부망 PC와 외부망 PC가 구분되어 있어, 옮기는 과정에 일부 오타가 있을 수 있습니다.
HttpsURLConnection mHttpsUC;
OutputStreamWriter writer = null;
BufferedReader reader = null;
InputStreamReader isr = null;
String pRequestMethod = “POST”
URL url = new URL(“https://kapi.kakao.com/v1/user/me”);
mHttpsUC= (HttpsURLConnection) url.openConnection();
mHttpsUC.setRequestMethod(pRequestMethod);
mHttpsUC.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
mHttpsUC.setRequestProperty("Authorization", "Bearer " + 받은토큰);
mHttpsUC.setRequestProperty("charset", "utf-8");
mHttpsUC.setDoOutput(true);
mHttpsUC.setDoInput(true)
/*전송할 POST 데이터가 있는 경우, 만드는 로직*/
int responseCode = conn.getResponseCode();
if (responseCode == 200)
isr = new InputStreamReader(conn.getInputStream());
else
isr = new InputStreamReader(conn.getErrorStream());
reader = new BufferedReader(isr);
final StringBuffer buffer = new StringBuffer();
String line;
while ((line = reader.readLine()) != null) {
buffer.append(line);
}
System.out.println(buffer.toString());
return buffer.toString();
@anon37646735
코드로는 이상한 부분이 없어보이는데요, 테스트 하시는 곳에 네트워크(방화벽) 상태를 확인해 보시기 바랍니다.