Skip to content

Google Health / Fitbit Setup ​

Read-Only OAuth Configuration ​

Enable Google Health API in Google Cloud, configure an External / Testing OAuth app with your account as a test user, and add these read-only scopes:

  • https://www.googleapis.com/auth/googlehealth.activity_and_fitness.readonly
  • https://www.googleapis.com/auth/googlehealth.health_metrics_and_measurements.readonly
  • https://www.googleapis.com/auth/googlehealth.sleep.readonly
  • https://www.googleapis.com/auth/googlehealth.location.readonly (optional, for GPS TCX workout tracks)

Create a Desktop app OAuth client and place the downloaded JSON at .private/ghealth/client_secret.json (or embed it during build via -GoogleOAuthClientPath). Authorization opens an ephemeral local loopback port only during login.

Data Semantics & Pace Rules ​

  • 90-Day Atomic Fetch: Fetches the trailing 90 days (UTC+8 by default) in 14-day heart-rate and 7-day workout batches, committing atomically to SQLite only after full success.
  • No Fabricated Zeros: Missing observations remain blank rather than distorting averages with fake zeros.
  • Units & Active Duration: Weight converts grams to kg, distance converts millimeters to km, and workouts use activeDuration excluding pauses.
  • GPS Pace: Uses official averagePaceSecondsPerMeter when available; per-point track pace uses a ~20-second sliding window, resets across >90s gaps, labels pauses as stationary, and never alters raw WGS84 points.

KeepPace · Part of the Keep Suite · MIT License