52 lines
1.4 KiB
Markdown
52 lines
1.4 KiB
Markdown
# 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:
|
|
```bash
|
|
cp .env.example .env
|
|
```
|
|
|
|
2. Update the `.env` file with your actual Garmin credentials:
|
|
```bash
|
|
nano .env
|
|
```
|
|
|
|
3. Run the script:
|
|
```bash
|
|
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) |