isStoryUser Forbidden

RESTTOOL 을 통해서는 결과값이 잘 나오고 있습니다.

===========================================
카카오스토리 사용자 확인 (/v1/api/story/isstoryuser)

Request Preview

Header
Authorization: Bearer THsJVOuDodxrMe66qTnh8F30hXTUl_KYak51ugo8BVUAAAFZo6bgFg
HTTP Method
GET
URL
https://kapi.kakao.com/v1/api/story/isstoryuser
Parameter
요청하기
응답정보
200 OK
Date: Sun, 15 Jan 2017 20:22:54 GMT
Content-Encoding: gzip
Connection: keep-alive
Transfer-Encoding: chunked
Content-Type: application/json; charset=utf-8
{
“isStoryUser”: true
}

======================================================
PHP CODE

function curl_fetch($_URL, $_token) {
$header = array();
$header = “application/json;charset=utf-8”;
$header = "Authorization: Bearer ".$_token;

	$opts = array( 
	 CURLOPT_URL => $_URL, 
	 CURLOPT_SSL_VERIFYPEER => false, 
	 CURLOPT_SSLVERSION => 1, // TLS
	 CURLOPT_POST => true, 
	 CURLOPT_POSTFIELDS => $params, 
	 CURLOPT_RETURNTRANSFER => true, 
	 CURLOPT_HEADER => false,
	 CURLOPT_HTTPHEADER => $header
	);		
	
$ch = curl_init(); 
	curl_setopt_array($ch, $opts); 
$a = curl_exec($ch);
curl_close($ch);
return $a;

}
$kakao_access_token = “THsJVOuDodxrMe66qTnh8F30hXTUl_KYak51ugo8BVUAAAFZo6bgFg”;
$KAKAO_API_URL = “https://kapi.kakao.com/v1/api/story/isstoryuser”;
$result = curl_fetch($KAKAO_API_URL, $kakao_access_token);
$is_story_user = json_decode($result);
print_r($result);

========================================================

결곽값이 아래와 같습니다.

Forbidden
Forbidden

==========================================================

https://kapi.kakao.com/v1/user/me
https://kapi.kakao.com/v1/api/story/profile

두개는 모두 잘 나오는데

https://kapi.kakao.com/v1/api/story/isstoryuser

해당 API 만 Forbidden 에러가 발생합니다.
다른 키가 필요한지요?

========================================================
터미널에서 직접실행시에는 잘 나옵니다.

[root@blemowall home]# curl -v -X GET https://kapi.kakao.com/v1/api/story/isstoryuser \

-H “Authorization: Bearer THsJVOuDodxrMe66qTnh8F30hXTUl_KYak51ugo8BVUAAAFZo6bgFg”

  • About to connect() to kapi.kakao.com port 443 (#0)
  • Trying 203.133.166.33… connected
  • Connected to kapi.kakao.com (203.133.166.33) port 443 (#0)
  • Initializing NSS with certpath: sql:/etc/pki/nssdb
  • CAfile: /etc/pki/tls/certs/ca-bundle.crt
    CApath: none
  • SSL connection using TLS_DHE_RSA_WITH_AES_256_CBC_SHA
  • Server certificate:
  • subject: CN=*.kakao.com,O=Kakao Corp.,L=Jeju-si,ST=Jeju-do,C=KR
  • start date: Nov 11 00:00:00 2015 GMT
  • expire date: Nov 10 23:59:59 2017 GMT
  • common name: *.kakao.com
  • issuer: CN=thawte SSL CA - G2,O=“thawte, Inc.”,C=US

GET /v1/api/story/isstoryuser HTTP/1.1
User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.0.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
Host: kapi.kakao.com
Accept: /
Authorization: Bearer THsJVOuDodxrMe66qTnh8F30hXTUl_KYak51ugo8BVUAAAFZo6bgFg

< HTTP/1.1 200 OK
< Date: Sun, 15 Jan 2017 20:42:10 GMT
< Server: Apache
< Content-Type: application/json;charset=UTF-8
< Content-Length: 20
<

  • Connection #0 to host kapi.kakao.com left intact
  • Closing connection #0
    {“isStoryUser”:true}

@uchohw https://kapi.kakao.com/v1/api/story/isstoryuser 요청시 “CURLOPT_POST => true” 로 되어서인것 같아요. GET 요청으로 한번 바꿔보세요!