'fail', 'message' => 'userId 또는 loginId 누락']); // exit; // } // $url = "https://api.descope.com/v1/mgmt/user/delete"; // $payload = json_encode([ // "userId" => $userId, // "loginId" => $loginId // ]); // $headers = [ // "Authorization: Bearer $management_key", // "Content-Type: application/json" // ]; // $ch = curl_init($url); // curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); // curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); // $response = curl_exec($ch); // $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); // curl_close($ch); // if ($http_code === 200) { // echo json_encode(['status' => 'ok', 'message' => '탈퇴 성공']); // } else { // echo json_encode([ // 'status' => 'fail', // 'message' => '탈퇴 실패', // 'code' => $http_code, // 'response' => $response // ]); // } ?> 'fail', 'message' => 'userId 또는 loginId가 필요합니다.']); exit; } $url = "https://api.descope.com/v1/mgmt/user/delete"; $payload = []; if ($userId) $payload['userId'] = $userId; if ($loginId) $payload['loginId'] = $loginId; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ "Authorization: Bearer {$management_key}", "Content-Type: application/json" ]); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload)); $response = curl_exec($ch); $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); $err = curl_error($ch); curl_close($ch); if ($err) { echo json_encode(['status' => 'fail', 'message' => 'cURL error', 'error' => $err]); exit; } if ($http_code === 200) { echo json_encode(['status' => 'ok', 'message' => '탈퇴 처리 완료']); } else { echo json_encode([ 'status' => 'fail', 'message' => 'Descope delete 실패', 'code' => $http_code, 'res' => $response ]); } ?>