Trang 6
Tổng quan (tiếp)
Tổng quan (tiếp)
Bắt đầu nhanh
// Chạy ở máy chủ website (Node 18+)
const res = await fetch('https://api-app.1stw.vn/api/v1/auth/tokens', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
UserName: 'nv001@tencongty',
Password: process.env.STWAY_API_KEY, // khoá API stw_…
Device: 3,
DeviceId: 'web-b2b',
}),
});
const { ok, tokenRequest } = await res.json();Kết quả: { "tokenRequest": "<tokenRequest>", "ok": true }. Token chỉ sống 120 giây: lấy token mới trước mỗi lượt đẩy đơn.
7stway.vn
