Self-healing Garmin Connect OAuth authentication — login, token refresh, and rate limit recovery
Project description
garmin-auth
Self-healing Garmin Connect OAuth authentication for Python.
Handles the complex Garmin SSO flow (OAuth1 → OAuth2), automatic token refresh, and rate limit recovery — so you don't have to.
Install
pip install garmin-auth
For PostgreSQL token storage:
pip install garmin-auth[db]
Quick Start
from garmin_auth import GarminAuth
auth = GarminAuth(email="you@example.com", password="yourpassword")
client = auth.login() # Returns an authenticated garminconnect.Garmin client
# Use the client
activities = client.get_activities(0, 10)
Or use environment variables:
export GARMIN_EMAIL=you@example.com
export GARMIN_PASSWORD=yourpassword
auth = GarminAuth()
client = auth.login()
CLI
# Login and save tokens
garmin-auth login --email you@example.com --password yourpassword
# Check token status
garmin-auth status
# Refresh tokens (for cron jobs / CI)
garmin-auth refresh
Token Storage
File-based (default): Tokens saved to ~/.garminconnect/ as JSON files.
auth = GarminAuth(token_dir="~/.garminconnect")
PostgreSQL: For CI/CD or multi-machine setups.
from garmin_auth import GarminAuth, DBTokenStore
auth = GarminAuth(store=DBTokenStore("postgresql://user:pass@host/db"))
How It Works
Three strategies, tried in order:
- Cached token — If OAuth2 has >1h remaining, use it (instant)
- Token exchange — Use OAuth1 to get fresh OAuth2 (no password needed)
- Full SSO login — Email/password through Garmin's SSO flow (last resort)
This means tokens stay fresh automatically, and even if they fully expire, the package recovers without manual intervention.
Docker
docker build -t garmin-auth .
docker run -e GARMIN_EMAIL=... -e GARMIN_PASSWORD=... garmin-auth refresh
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file garmin_auth-0.1.1.tar.gz.
File metadata
- Download URL: garmin_auth-0.1.1.tar.gz
- Upload date:
- Size: 13.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16c5b26709549a098752d8c82e79a55821156e2bd9c97bc7e4a4692120452e47
|
|
| MD5 |
19840dbc87d5ef14ec42f7682703a30c
|
|
| BLAKE2b-256 |
530f9b26d3ab0ec4e6f53dbacad25d8b8107c5cd352308eaf5a4e3582673123b
|
Provenance
The following attestation bundles were made for garmin_auth-0.1.1.tar.gz:
Publisher:
publish.yml on drkostas/garmin-auth
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
garmin_auth-0.1.1.tar.gz -
Subject digest:
16c5b26709549a098752d8c82e79a55821156e2bd9c97bc7e4a4692120452e47 - Sigstore transparency entry: 1219466520
- Sigstore integration time:
-
Permalink:
drkostas/garmin-auth@edda5badec33b469c6c7a0d95f53b3743b504dd9 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/drkostas
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@edda5badec33b469c6c7a0d95f53b3743b504dd9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file garmin_auth-0.1.1-py3-none-any.whl.
File metadata
- Download URL: garmin_auth-0.1.1-py3-none-any.whl
- Upload date:
- Size: 14.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
84aa2911e5ec4dfcfb7e52441e5e23357cf528fbb9757f86eb53dbb7362575d0
|
|
| MD5 |
560cbf521d78ac070f5e598b07a7d18b
|
|
| BLAKE2b-256 |
9cd18de20093ee83c31b55443caa348f92e44c34bab6d503cfb8e22e82423770
|
Provenance
The following attestation bundles were made for garmin_auth-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on drkostas/garmin-auth
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
garmin_auth-0.1.1-py3-none-any.whl -
Subject digest:
84aa2911e5ec4dfcfb7e52441e5e23357cf528fbb9757f86eb53dbb7362575d0 - Sigstore transparency entry: 1219466572
- Sigstore integration time:
-
Permalink:
drkostas/garmin-auth@edda5badec33b469c6c7a0d95f53b3743b504dd9 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/drkostas
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@edda5badec33b469c6c7a0d95f53b3743b504dd9 -
Trigger Event:
push
-
Statement type: