> For the complete documentation index, see [llms.txt](https://qubeguard.gitbook.io/qubeguard-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://qubeguard.gitbook.io/qubeguard-docs/use-cases/authentication-apis.md).

# Authentication APIs

Secure login endpoints:

```javascript
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" });
});

```
