Garmin SSO auth + Connect Python client
Features
- OAuth1/OAuth2 authentication (OAuth1 token lasts ~1 year)
- MFA support with custom handlers
- Auto-refresh of OAuth2 token
- Auto-resume from
GARTH_HOMEorGARTH_TOKENenvironment variables - Works on Google Colab
- Pydantic dataclasses for validated data
- Full test coverage
Installation
Quick Start
Authenticate and save session
import garth from getpass import getpass garth.login(input("Email: "), getpass("Password: ")) garth.save("~/.garth")
Resume session
import garth from garth.exc import GarthException garth.resume("~/.garth") try: garth.client.username except GarthException: # Session is expired. You'll need to log in again pass
Or use environment variables for automatic session restoration:
export GARTH_HOME=~/.garth # or export GARTH_TOKEN="eyJvYXV0aF90b2tlbi..." # from `uvx garth login`
import garth # Session is automatically loaded garth.client.username
Fetch data
# Get daily stress garth.DailyStress.list("2023-07-23", 7) # Get sleep data garth.SleepData.get("2023-07-20") # Get weight garth.WeightData.list("2025-06-01", 30) # Direct API calls garth.connectapi("/usersummary-service/stats/stress/weekly/2023-07-05/52")
Documentation
Full documentation at garth.readthedocs.io
MCP Server
garth-mcp-server is in early development.
To generate your GARTH_TOKEN, use uvx garth login.