33 lines
979 B
PHP
33 lines
979 B
PHP
<?php
|
|
header('Content-Type: application/json; charset=utf-8');
|
|
|
|
$email = $_POST['email'] ?? '';
|
|
if (!$email) exit(json_encode(['status'=>'fail', 'message'=>'이메일 누락']));
|
|
|
|
// 아래 내용은 실제 사용중인 Descope OTP 전송 API와 맞게 수정해야 함
|
|
$api_key = "P2wON5fy1K6kyia269VpeIzYP8oP";
|
|
$url = "https://api.descope.com/v1/auth/otp/signup/email";
|
|
|
|
$data = [
|
|
"loginId" => $email,
|
|
];
|
|
|
|
$ch = curl_init($url);
|
|
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
|
"Authorization: Bearer {$api_key}",
|
|
"Content-Type: application/json"
|
|
]);
|
|
curl_setopt($ch, CURLOPT_POST, true);
|
|
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
$res = curl_exec($ch);
|
|
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
|
curl_close($ch);
|
|
|
|
if ($http_code == 200) {
|
|
echo json_encode(['status'=>'ok']);
|
|
} else {
|
|
echo json_encode(['status'=>'fail','message'=>'OTP 재전송 실패']);
|
|
}
|
|
?>
|