abrander / garmin-connect

Golang client for the (unoffical reverse engineered) Garmin Connect API
MIT License
136 stars 29 forks source link

Forbidden again | Migrate to new auth ? #26

Open RobertWojtowicz opened 1 year ago

RobertWojtowicz commented 1 year ago

Hi, @abrander @davidkroell

Again there is a problem with authorization, maybe the solution is a new method of authorization? (OAuth): https://github.com/petergardfjall/garminexport/pull/104

The problem is already reported in 2 threads using bodycomposition (based on the garmin-connect library): https://github.com/RobertWojtowicz/miscale2garmin/issues/31 https://github.com/davidkroell/bodycomposition/issues/19

BR, Robert

davidkroell commented 1 year ago

They are using matin/garth which is written in python. I think we'll need a Golang port for that to fix authentication flow again.

@abrander are you willing to implement this?

abrander commented 1 year ago

This one is irritating. We're getting caught in Cloudflare's anti-bot system. I would really like to know if Garmin changed something to get rid of third-party API usage, if Cloudflare changed something, or if the "web department" at Garmin simply turned on bot-protection for the complete garmin.com-domain without considering the API endpoints. If Garmin is actively trying to deter third parties from using the API this will turn into a year-long whack-a-mole, which will be fun but time-consuming.

@davidkroell You're mentioning OAuth - fun fact: The initial version of this package (before publishing to Github) did, in fact, use oauth2, but I opted for automating the web-based flow before publishing. I'm not not willing to implement this again ;-)

I don't know the best way forward. OAuth1/2 is well-understood as a protocol. Still, I like that we have existed for almost five years without leaking Garmin secrets and being honest about who we are - and I would like to continue doing exactly that.

Another well-known Garmin API project makes the OAuth tokens available in Amazon S3 - maybe we can retrieve those at runtime? Then we don't actually publish them ourselves, but it would still work out of the box for end-users..?

I see some options:

Technically I think A1 and A2 are the easiest to implement.

matin commented 1 year ago

Garth maintainer here.

Some comments:

RobertWojtowicz commented 1 year ago

Hi @abrander

Any good news in solving this problem ? Unfortunately alternate YAGCC client does not support ARMv6 (older RPi). https://github.com/RobertWojtowicz/miscale2garmin/issues/34

I'd like to return to the good bodycompositon solution created by @davidkroell

BR, Robert

RobertWojtowicz commented 7 months ago

Hi, @abrander

I created a new version based on this solution, a very useful approach with tokens: https://github.com/cyberjunky/python-garminconnect https://github.com/RobertWojtowicz/miscale2garmin/blob/master/import_tokens.py https://github.com/RobertWojtowicz/miscale2garmin/blob/master/export_garmin.py

BR, Robert