← Back to Index

OAuth Token Health Tracking

Purpose: Monitor OAuth token expiration, refresh cycles, and prevent authentication failures.

Token Status Dashboard

Service Status Last Refresh Expires Auto-Refresh Notes
Google Calendar ✅ Healthy (check file mtime) N/A Yes /credentials/google-calendar-tokens.json
Google Drive ✅ Healthy (check file mtime) N/A Yes /credentials/google-drive-tokens.json
UPS ✅ Healthy (check file mtime) (check token) Yes /credentials/ups-token.json
Gmail 🔴 Not setup - - - Not implemented
Zoho (all) 🔴 Not setup - - - Not implemented

Monitoring Protocol

Daily Health Check

Run this command to check token file freshness:

find /home/node/.openclaw/credentials -name "*token*.json" -mtime +7 -ls

Alert if: Any token file not modified in 7+ days (suggests stale or unused auth)

Weekly Review

Every Sunday (during rebuild window 9:45 PM PT):

  1. Check token file modification times
  2. Verify no expired tokens in logs
  3. Test one API call per service (smoke test)
  4. Document any refresh failures

Token Refresh Failure Response

If auto-refresh fails:

  1. Check credential file exists and is valid JSON
  2. Verify IP allowlist (if applicable, e.g. Vultr, UPS)
  3. Check API service status (provider outage?)
  4. Review error message for scope changes or revoked access
  5. If 3+ consecutive failures: Alert to Infrastructure & Tech group
  6. Manual re-auth if refresh token expired (rare, usually 6-12 month lifetime)

Google Services OAuth

Calendar & Drive

Gmail

UPS OAuth

Zoho OAuth (Planned)

Multi-Service Complexity

Zoho uses single OAuth for all services (CRM, Books, Desk, Cliq, etc.)

Zoho OAuth Setup Steps (When Ready)

  1. Create OAuth app in Zoho API Console
  2. Configure redirect URI (localhost for token exchange)
  3. Request required scopes
  4. Generate authorization code
  5. Exchange for access/refresh tokens
  6. Store in /credentials/zoho-tokens.json
  7. Implement auto-refresh in automation scripts
  8. Test each service endpoint (CRM, Books, Desk, Cliq)

Token Security Best Practices

Storage

Access Control

Rotation

Alert Thresholds

Critical (Immediate Response)

Warning (Review Within 24h)

Info (Weekly Review)

Recovery Procedures

Lost or Corrupted Token File

  1. Check git history: git log -- credentials/<service>-tokens.json
  2. Restore from 1Password backup
  3. If both fail: Re-authenticate from scratch
  4. Update token file path in all scripts

Provider Revoked Access

  1. Check provider console/email for revocation reason
  2. Review app permissions, scopes, terms of service
  3. Re-submit app for review if required
  4. Re-authenticate with corrected configuration
  5. Document incident in incident-log.md

Scope Expansion Needed

  1. Update OAuth app configuration (provider console)
  2. Request additional scopes
  3. Re-authenticate to grant new permissions
  4. Update token file with new scope list
  5. Test new API endpoints

Last Updated: 2026-02-16
Next Review: Sunday 9:45 PM PT (weekly during rebuild window)