Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a Garth OAuth implementation fixes #95 #96

Merged
merged 10 commits into from
Oct 8, 2023

Conversation

SimonBaars
Copy link
Contributor

For full context, see the relevant issue thread: #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:

  • The OAuth flow also required using the new endpoints (which could be migrated by simply removing the proxy)
  • Removed the user profile fetch, since it was really only to determine the number of activities, and there's a way simpler way to do that.

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

@sgowtham
Copy link

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
Copy link
Contributor Author

SimonBaars commented Sep 27, 2023

@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
Copy link

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
Copy link
Contributor Author

@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
Copy link
Owner

pe-st commented Sep 27, 2023

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

Copy link
Owner

@pe-st pe-st left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your great work :-) I have only some minor suggestions

gcexport.py Outdated Show resolved Hide resolved
gcexport.py Outdated Show resolved Hide resolved
gcexport.py Outdated Show resolved Hide resolved
gcexport.py Outdated Show resolved Hide resolved
gcexport.py Outdated Show resolved Hide resolved
requirements.txt Outdated Show resolved Hide resolved
gcexport.py Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@SimonBaars
Copy link
Contributor Author

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

@telemaxx
Copy link
Contributor

telemaxx commented Oct 7, 2023

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 pe-st merged commit 87b5aac into pe-st:master Oct 8, 2023
@pe-st
Copy link
Owner

pe-st commented Oct 8, 2023

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
Copy link

mainzelM commented Oct 8, 2023

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

@telemaxx
Copy link
Contributor

@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)

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.

5 participants