ErrorAuth
Gateway token invalid or rejected
OpenClaw uses a gateway token to authenticate API requests. This error means the token in your environment doesn't match what the server expects — usually a copy-paste issue or a regenerated token.
Symptoms
- •
401 Unauthorized errors in the dashboard - •
Invalid gateway token in server logs - •
OpenClaw refuses WebSocket connections
Causes
- •The GATEWAY_TOKEN environment variable has a typo or extra whitespace
- •Token contains special characters that weren't escaped properly
- •Token was regenerated in the dashboard but not updated in the .env file
- •Environment variable not loaded (missing .env file or wrong path)
Solution
Check your current token
docker compose exec openclaw printenv GATEWAY_TOKEN
Compare this with the token shown in your OpenClaw dashboard.
Fix the .env file
Open your .env and make sure the token has no extra spaces or quotes:
# Correct
GATEWAY_TOKEN=abc123def456
# Wrong — don't wrap in quotes
GATEWAY_TOKEN="abc123def456"
Restart the container
docker compose down
docker compose up -d
Regenerate if needed
If the token was compromised or you're unsure, regenerate it in the OpenClaw dashboard under Settings > API > Regenerate Token, then update your .env file and restart.