Authentication
Securing access to the OpenClaw gateway.
Overview
The gateway supports multiple authentication methods:
- API keys
- Bearer tokens
- OAuth (for channels)
API Key Authentication
Generate an API key:
bash
openclaw gateway api-key generateUse in requests:
bash
curl -H "X-API-Key: your-key" http://localhost:3000/api/...Configuration
json5
{
gateway: {
auth: {
enabled: true,
apiKey: "your-secret-key",
allowedIPs: ["127.0.0.1"]
}
}
}Bearer Token
bash
curl -H "Authorization: Bearer your-token" http://localhost:3000/api/...Channel Authentication
Each channel has its own authentication:
| Channel | Auth Method |
|---|---|
| QR code pairing | |
| Telegram | Bot token |
| Discord | OAuth + Bot token |
| Slack | OAuth |
Security Best Practices
- Enable authentication for production use
- Use HTTPS when exposing to the internet
- Restrict IP addresses when possible
- Rotate keys regularly