친구 목록 가져오기 api

owner : ahrtears54@nate.com
app name: Auto arxiv

친구 목록 가져오기를 시도하고있습니다.
조건 4가지
-카카오톡 친구일것
-목록을 내려받는 서비스에 가입한 사용자 일것
-친구목록 제공에 동의한 사용자일것
-(검수 전) 팀 멤버로 등록되어 있을 것
를 만족하였고 다음의 명령어를 입력하였으나 결과가 0으로 나옵니다.

정상적인 친구 목록을 가져오려면 어떤 작업을 추가로하여야하나요?

curl -v GET “https://kapi.kakao.com/v1/api/talk/friends” -H “Authorization: Bearer [appkey]”

  • Could not resolve host: GET
  • Closing connection 0
    curl: (6) Could not resolve host: GET
  • Trying 203.133.166.33…
  • TCP_NODELAY set
  • Connected to kapi.kakao.com (203.133.166.33) port 443 (#1)
  • ALPN, offering http/1.1
  • successfully set certificate verify locations:
  • CAfile: /Users/han_mini/anaconda3/ssl/cacert.pem
    CApath: none
  • TLSv1.3 (OUT), TLS handshake, Client hello (1):
  • TLSv1.3 (IN), TLS handshake, Server hello (2):
  • TLSv1.2 (IN), TLS handshake, Certificate (11):
  • TLSv1.2 (IN), TLS handshake, Server key exchange (12):
  • TLSv1.2 (IN), TLS handshake, Server finished (14):
  • TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
  • TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
  • TLSv1.2 (OUT), TLS handshake, Finished (20):
  • TLSv1.2 (IN), TLS handshake, Finished (20):
  • SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
  • ALPN, server accepted to use http/1.1
  • Server certificate:
  • subject: C=KR; ST=Jeju-do; L=Jeju-si; O=Kakao Corp.; CN=*.kakao.com
  • start date: Jul 9 00:00:00 2018 GMT
  • expire date: Oct 8 12:00:00 2020 GMT
  • subjectAltName: host “kapi.kakao.com” matched cert’s “*.kakao.com”
  • issuer: C=US; O=DigiCert Inc; OU=www.digicert.com; CN=Thawte TLS RSA CA G1
  • SSL certificate verify ok.

GET /v1/api/talk/friends HTTP/1.1
Host: kapi.kakao.com
User-Agent: curl/7.63.0
Accept: /
Authorization: Bearer [appkey]

< HTTP/1.1 200 OK
< Date: Sun, 23 Aug 2020 15:27:44 GMT
< Server: Apache
< Quota-Type: INC_AND_CHECK
< Content-Type: application/json;charset=UTF-8
< Content-Length: 156
<

{“elements”:[],“total_count”:0,“after_url”:null,“result_id”:“zbnYtN-AsYm4jr-KuoO36Nzr3-7W4b7Mqc6n1KDFt9K26Y_umPeF7Jj9opPMrcGt8pn2qd_sFg”,“favorite_count”:0}

추가로 scope에도 friends는 나옵니다.

{“access_token”: “–”, “token_type”: “bearer”, “refresh_token”: “–”, “expires_in”: 21599, “scope”: “talk_message profile friends”, “refresh_token_expires_in”: 5183999}

올려주신 앱의 팀멤버중, owner를 제외한 나머지 계정이 위 두 조건을 만족하고 있지 않습니다.

친구 목록을 조회하려는 사용자 뿐만 아니라 목록에 나와야하는 사용자 또한 네가지 조건에 모두 만족해야 합니다.

동적동의에서

https://kauth.kakao.com/oauth/authorize?response_type=code&redirect_uri=https://localhost.com&scope=profile,talk_message,friends&client_id={app_key}

로 들어가서 동의를 하고 코드를 받아 scope를 살펴보면 친구만 뜨고 나머지가 등록이 되질 않습니다.

제가 동적동의를 잘못된 방법으로 시행하고있는 것인가요?

위에서는 정상적으로 호출한 이력도 있는데 요청이 어떻게 달라졌을까요?
확인한 것으로 이상한 점들은 redirect uri에 정상적인 uri를 설정하지 않으셨습니다. 정상적인 uri로 설정하고 다시 확인부탁드립니다.

호출 요청이 달라진 것은 처음엔 A의 호출을 첨부하였는데 이번엔 B의 호출을 올렸습니다. 혼동을 드려 죄송합니다.

redirect_uri에 대해서 말씀하신 점이 잘 이해가 되지 않습니다.
A의 경우 https://localhost.com으로 동적동의를 하여 friends를 추가하였었습니다.
B도 같은 방식으로 했으나 되지 않아 http://solomonhouse.synology.me 로도 해보았으나 동의 창이 뜨고 승락시 redirect_uri로 넘어가나 호출하면 profile과 talk_message가 scope에 추가되지 않습니다.

정상적인 uri경로는 포트 80, 433, http, https 프로토콜 이외에 어떤걸 말하나요?

답변주셔서 감사합니다.

위 uri는 정상적으로 동작하는 uri가 아닌것으로 보입니다.

redirect uri는 카카오 인증 서버가 발급한 코드를 전달하는 경로를 지정하는 파라미터입니다. 이 uri를 통해 발급된 코드로 토큰을 요청해야 정상적으로 acess token을 발급받고, scope을 확인할 수 있습니다.

다시말해, 정상적인 경로란, 개발중인 서비스에서 "코드를 받아 토큰을 요청하는 서비스의 주소"입니다.