Auth0 Monitoring Essentials
Auth0 is your app's front door. When it's slow or unavailable, users can't log in.
Log Auth Events
app.use((err, req, res, next) => {
if (err.status === 401) {
console.error(JSON.stringify({
event: 'auth_failure',
status: err.status,
path: req.path
}));
}
next(err);
});
Health Check for External Monitoring
Add an unauthenticated health endpoint and monitor it with Vigilmon:
app.get('/health', (req, res) => {
res.json({ status: 'ok', auth_domain: process.env.AUTH0_DOMAIN });
});
Also monitor your Auth0 tenant URL directly - if it returns an error, logins fail for everyone.
Callback URL Error Tracking
app.get('/callback', (req, res, next) => {
if (req.query.error) {
console.error(JSON.stringify({
event: 'auth0_callback_error',
error: req.query.error,
description: req.query.error_description
}));
}
next();
});
Alert Checklist
- Login failure rate > 5% over 5 minutes
- Auth0 tenant URL unreachable
- Callback errors spiking
- Subscribe to Auth0 status page
- External uptime monitor via Vigilmon
Top comments (0)