pe-st / garmin-connect-export

Download a copy of your Garmin Connect data, including stats and GPX tracks.
MIT License
364 stars 75 forks source link

Use a Garth OAuth implementation fixes #95 #96

Closed SimonBaars closed 11 months ago

SimonBaars commented 11 months ago

For full context, see the relevant issue thread: https://github.com/pe-st/garmin-connect-export/issues/95

TLDR: Garmin shut down the old authentication flow. The new authentication flow has many security measures in place to script the login. Using a recommendation in an issue on a similar repo, we use the Garth library to implement an OAuth flow, which should be more robust than the original method.

Review notes:

Thanks to @geraudloup for investigating this with me, and @app4g for the support!

sgowtham commented 11 months ago

I can confirm that the python script is working as expected after running the following commands

pip3 install garth --user
curl https://patch-diff.githubusercontent.com/raw/pe-st/garmin-connect-export/pull/96.diff | git apply

When I run

python3 ./gcexport.py -c 1 -ot -u

it works but the workflow continues to download far more than just one activity. I am assuming the final observation is a case of RTFM on my part.

SimonBaars commented 11 months ago

@sgowtham Thanks for testing, and that's not a RTFM on your part! I was a little bit overzealous when I re-designed the activity fetching 😧
I committed a fix! 😄

sgowtham commented 11 months ago

Thank you :)

This could be a separate feature request, if need be. I am wondering if all files associated with an activity (e.g., csv, fit, gpx, kml, tcx, and hrZones) could be downloaded in one call instead of making separate calls for each such file?

SimonBaars commented 11 months ago

@sgowtham Whether it's technically possible, I'm not sure. But yeah, that should be a separate feature. Feel free to open an issue to start a discussion :)

pe-st commented 11 months ago

Thanks a lot for investigating this and coming up with a solution! This week I have no time to look at the PR in detail, but I hope I'll manage to early next eek

SimonBaars commented 11 months ago

Hey @pe-st , I addressed all comments :)

telemaxx commented 11 months ago

i just tried this PR

when i enter:

c:\Python3\python.exe C:\Users\top\git\garmin-connect-export-pest\gcexport.py -c 5 -f gpx --username "myname" --password "mypassword" --directory "C:\public\gps"

all activities are downloaded. (because of -c 5 it should be only 5)

@SimonBaars: do i something wrong?

pe-st commented 11 months ago

i just tried this PR

when i enter:

c:\Python3\python.exe C:\Users\top\git\garmin-connect-export-pest\gcexport.py -c 5 -f gpx --username "myname" --password "mypassword" --directory "C:\public\gps"

all activities are downloaded. (because of -c 5 it should be only 5)

@SimonBaars: do i something wrong?

I think this was a small glitch that I fixed when merging the PR

mainzelM commented 11 months ago

@SimonBaars: Thanks a lot for the fix! Also thanks to @pe-st for maintaining this repo :smile:

telemaxx commented 10 months ago

@SimonBaars @martin @pe-st : from my side also a big Thank You.

everything is working with windows and linux.

BTW: updating of garth with: pip install --upgrade garth (maybe helpful for someone)