#!/usr/bin/env python3 # ABOUTME: PhaseFlow Garmin Token Generator using garth library. # ABOUTME: Run this locally to authenticate with Garmin (supports MFA). """ PhaseFlow Garmin Token Generator Run this locally to authenticate with Garmin (supports MFA) Usage: pip install garth python3 garmin_auth.py """ import json from getpass import getpass try: import garth except ImportError: print("Error: garth library not installed.") print("Please install it with: pip install garth") exit(1) email = input("Garmin email: ") password = getpass("Garmin password: ") # MFA handled automatically - prompts if needed garth.login(email, password) tokens = { "oauth1": garth.client.oauth1_token.serialize(), "oauth2": garth.client.oauth2_token.serialize(), "expires_at": garth.client.oauth2_token.expires_at.isoformat() } print("\n--- Copy everything below this line ---") print(json.dumps(tokens, indent=2)) print("--- Copy everything above this line ---") print(f"\nTokens expire: {tokens['expires_at']}")