문의 시, 사용하시는 개발환경과 디벨로퍼스 앱ID를 알려주세요.
ID 984956 입니다.
인증코드는 로그인 버튼 클릭시 마다 새롭게 불러오고 있는데.
해당 오류가 발생합니다.
//사용자 토큰 받기
$code = $_GET["code"];
$params = sprintf( 'grant_type=authorization_code&client_id=%s&redirect_uri=%s&code=%s', KAKAO_RESTAPI_KEY, KAKAO_CALLBACK_URL, $code);
$TOKEN_API_URL = "https://kauth.kakao.com/oauth/token";
$opts = array(
CURLOPT_URL => $TOKEN_API_URL,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSLVERSION => 1, // TLS
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $params,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => false
);
$curlSession = curl_init();
curl_setopt_array($curlSession, $opts);
$accessTokenJson = curl_exec($curlSession);
curl_close($curlSession);
$responseArr = json_decode($accessTokenJson, true);
// print_r($responseArr);
// exit;
$USER_API_URL= "https://kapi.kakao.com/v2/user/me";
$opts = array(
CURLOPT_URL => $USER_API_URL,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSLVERSION => 1,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => false,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array( "Authorization: Bearer " . $responseArr['access_token'] )
);
$curlSession = curl_init();
curl_setopt_array($curlSession, $opts);
$accessUserJson = curl_exec($curlSession);
curl_close($curlSession);
$me_responseArr = json_decode($accessUserJson, true);