Files
FitTrack2/FitnessSync/SAVE_GARMIN_CREDS.md
2025-12-24 18:12:11 -08:00

1.4 KiB

Save Garmin Credentials Script

This script mimics the web UI call when hitting "Save Garmin Credentials". It loads Garmin credentials from a .env file and sends them to the backend API.

Usage

  1. Create a .env file based on the .env.example template:

    cp .env.example .env
    
  2. Update the .env file with your actual Garmin credentials:

    nano .env
    
  3. Run the script:

    python save_garmin_creds.py
    

Prerequisites

  • Make sure the backend service is running on the specified host and port (default: localhost:8000)
  • Ensure the required dependencies are installed (they should be in the main project requirements.txt)

Expected Response

Upon successful authentication, you'll see a response like:

Response: {
  "status": "success",
  "message": "Garmin credentials saved and authenticated successfully"
}

If MFA is required:

Response: {
  "status": "mfa_required",
  "message": "Multi-factor authentication required",
  "session_id": "some_session_id"
}

Environment Variables

  • GARMIN_USERNAME (required): Your Garmin Connect username
  • GARMIN_PASSWORD (required): Your Garmin Connect password
  • GARMIN_IS_CHINA (optional): Set to 'true' if you're using Garmin China (default: false)
  • BACKEND_HOST (optional): Backend host (default: localhost)
  • BACKEND_PORT (optional): Backend port (default: 8000)