'fail', 'message' => '리프레시 토큰 없음']); exit; } $url = "https://api.descope.com/v1/auth/refresh"; $headers = [ "Authorization: Bearer {$projectId}:{$refreshJwt}", "Content-Type: application/json" ]; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_POSTFIELDS, "{}"); // body는 비워둬도 됨 $response = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($httpCode === 200) { $data = json_decode($response, true); // 🔄 refreshJwt도 갱신됨 $_SESSION['refreshJwt'] = $data['refreshJwt']; echo json_encode([ 'status' => 'ok', 'sessionJwt' => $data['sessionJwt'] ]); } else { echo json_encode(['status' => 'fail', 'message' => '세션 갱신 실패', 'raw' => $response]); }