Authentication APIs

Secure login endpoints:

app.post("/login", async (req, res) => {
    const { username, password } = req.body;
    if (!username || !password) {
        return res.status(400).json({ error: "Missing credentials" });
    }

    const response = await fetch("https://app.qubeguard.com/control", {
        method: "POST",
        headers: { "Content-Type": "application/json", "x-api-key": "YOUR_API_KEY" },
        body: JSON.stringify(req.body),
    });

    if (response.status !== 200) {
        return res.status(403).json({ error: "Request blocked by Control API" });
    }

    res.status(200).json({ message: "Login successful" });
});

Last updated