최초 커밋
This commit is contained in:
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
// header('Content-Type: application/json');
|
||||
|
||||
// $management_key = 'P2wON5fy1K6kyia269VpeIzYP8oP:K2ycqpjeh1voPBdxXxzB3ScZOQ6v9aiLmU2cIj70X1H8Kcoz0KWfCWmofUwAsAkJroXA8QC';
|
||||
|
||||
// // userId 또는 loginId 사용 가능
|
||||
// $userId = $_POST['userId'] ?? '';
|
||||
// $loginId = $_POST['loginId'] ?? '';
|
||||
|
||||
// if (!$userId && !$loginId) {
|
||||
// echo json_encode(['status' => '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
|
||||
// ]);
|
||||
// }
|
||||
?>
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
|
||||
// TODO: 환경변수/별도 설정파일에서 읽어오세요.
|
||||
$management_key = 'P2wON5fy1K6kyia269VpeIzYP8oP:K32l5ORmzy32OvaaPvpdZsMY3JmKQb7a3vvrl10PgjlJUGk3K7EssMH3uW5VGQSbrgtEdPj';
|
||||
|
||||
$userId = $_POST['userId'] ?? '';
|
||||
$loginId = $_POST['loginId'] ?? '';
|
||||
|
||||
if (!$userId && !$loginId) {
|
||||
echo json_encode(['status' => '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
|
||||
]);
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user