'fail', 'message'=>'토큰 없음'])); $url = "https://api.descope.com/v1/auth/magiclink/verify"; $data = [ "token" => $token ]; $ch = curl_init($url); curl_setopt($ch, CURLOPT_HTTPHEADER, [ "Authorization: Bearer $api_key", "Content-Type: application/json" ]); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec($ch); $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); $resData = json_decode($response, true); if ($code == 200 && !empty($resData['refreshJwt'])) { echo json_encode([ 'status' => 'ok', 'refreshJwt' => $resData['refreshJwt'], 'email' => $resData['user']['email'] ?? ($resData['user']['loginIds'][0] ?? '') ]); } else { $msg = $resData['errorDescription'] ?? '인증 실패'; echo json_encode(['status'=>'fail', 'message'=>$msg, 'raw'=>$resData]); } ?>