Skip to content

Support Garmin MFA login and add .fit suffix to temp upload files#82

Open
lrybak wants to merge 4 commits into
jat255:mainfrom
lrybak:garmin-mfa
Open

Support Garmin MFA login and add .fit suffix to temp upload files#82
lrybak wants to merge 4 commits into
jat255:mainfrom
lrybak:garmin-mfa

Conversation

@lrybak

@lrybak lrybak commented May 13, 2026

Copy link
Copy Markdown
Contributor

Hello,
While running Fit-File-Faker on a fresh MyWhoosh profile I hit two issues:

1. MFA login support

Garmin(email, password) was constructed without a prompt_mfa callback. When Garmin's SSO required an MFA code, the underlying library raised:

GarminConnectAuthenticationError: MFA Required but no prompt_mfa mechanism supplied

I added a prompt_mfa callback that uses questionary (already a project dependency) to interactively ask the user for the one-time code. After a successful login, tokens are cached as before, so subsequent runs don't re-prompt.

2. Temp files must carry the .fit extension

Fix for:
GarminConnectInvalidFileFormatError: File has no extension: /var/folders/g9/401mxzxx7cj89pmjyvmnw5c00000gn/T/tmp2g2z9cmi

garminconnect validates the file extension in upload_activity() and rejects files without one. I added suffix=".fit" to both NamedTemporaryFile(...) calls in upload_all() and NewFileEventHandler.on_created().

@codecov-commenter

codecov-commenter commented May 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (bdbeb1d) to head (0140a0e).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #82   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            6         6           
  Lines         1226      1229    +3     
=========================================
+ Hits          1226      1229    +3     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sgfcz

sgfcz commented May 25, 2026

Copy link
Copy Markdown

good job,
I hit the same bug. Would be great to get this merged/released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants