-
Notifications
You must be signed in to change notification settings - Fork 16
Description
import { Session, ClientIdentifier } from "node-tls-client";
// URL của API endpoint
const url = "https://user-domain.blum.codes/api/v1/auth/provider/PROVIDER_TELEGRAM_MINI_APP";
// Payload
const payload = JSON.stringify({
query: "query_id=......................",
variables: {}
});
// Headers
const headers = {
"accept-language": "en-US,en;q=0.9,vi;q=0.8",
"content-type": "application/json",
"sec-ch-ua": '"Google Chrome";v="108", "Chromium";v="108", "Not_A Brand";v="24"',
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": '"Windows"',
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"
};
(async () => {
const session = new Session({ clientIdentifer: ClientIdentifier.chrome_120, timeout: 3000 });
try {
await session.init();
// Gửi yêu cầu POST
const response = await session.post(url, {
proxy: "http://user:password@host:port",
body: payload,
headers: headers
})
console.log(response.status, await response.text());
} catch (error) {
console.error("An error occurred:", error);
} finally {
await session.close();
}
})();