mirror of
https://github.com/sstent/FitTrack_GarminSync.git
synced 2026-01-25 00:21:58 +00:00
This commit resolves the persistent `garminconnect` login failure caused by changes in Garmin's SSO process. The authentication mechanism has been refactored to primarily use the `garth` library for initial login and Multi-Factor Authentication (MFA) handling, enhancing robustness and adhering to the feature plan. Key changes include: - Refactored `_perform_login` in `backend/src/services/garmin_auth_service.py` to directly utilize `garth.Client().login()`, replacing the problematic `garminconnect.login()`. - Updated `initial_login` to gracefully handle `garth`'s MFA exceptions, returning appropriate responses to guide the authentication flow. - Added a new `complete_mfa_login` method to `backend/src/services/garmin_auth_service.py` for submitting MFA codes and finalizing the login process. - Ensured `garminconnect` implicitly leverages the established `garth` session, eliminating redundant login attempts. - Addressed static analysis issues by updating `typing` imports and suppressing `mypy` errors for `garth.Client` attributes where appropriate.