tcgoetz / GarminDB

Download and parse data from Garmin Connect or a Garmin watch, FitBit CSV, and MS Health CSV files into and analyze data in Sqlite serverless databases with Jupyter notebooks.
GNU General Public License v2.0
1.09k stars 137 forks source link

Can't login to Garmin #209

Closed orutra11 closed 10 months ago

orutra11 commented 10 months ago

After creating a clean conda python 3.11 environment and installing with pip3

garmindb_cli.py --all --download --import --analyze

returns a Garth authentication error:

garmindb_cli.py --all --download --import --analyze
___Downloading All Data___
Traceback (most recent call last):
  File "/Users/arturo/opt/anaconda3/envs/runEnv311/lib/python3.11/site-packages/garth/http.py", line 125, in request
    self.last_resp.raise_for_status()
  File "/Users/arturo/opt/anaconda3/envs/runEnv311/lib/python3.11/site-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://sso.garmin.com/sso/signin?id=gauth-widget&embedWidget=true&gauthHost=https%3A%2F%2Fsso.garmin.com%2Fsso%2Fembed&service=https%3A%2F%2Fsso.garmin.com%2Fsso%2Fembed&source=https%3A%2F%2Fsso.garmin.com%2Fsso%2Fembed&redirectAfterAccountLoginUrl=https%3A%2F%2Fsso.garmin.com%2Fsso%2Fembed&redirectAfterAccountCreationUrl=https%3A%2F%2Fsso.garmin.com%2Fsso%2Fembed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/arturo/opt/anaconda3/envs/runEnv311/bin/garmindb_cli.py", line 366, in <module>
    main(sys.argv[1:])
  File "/Users/arturo/opt/anaconda3/envs/runEnv311/bin/garmindb_cli.py", line 347, in main
    download_data(args.overwrite, args.latest, args.stats)
  File "/Users/arturo/opt/anaconda3/envs/runEnv311/bin/garmindb_cli.py", line 112, in download_data
    if not download.login():
           ^^^^^^^^^^^^^^^^
  File "/Users/arturo/opt/anaconda3/envs/runEnv311/lib/python3.11/site-packages/garmindb/download.py", line 69, in login
    self.garth.login(username, password)
  File "/Users/arturo/opt/anaconda3/envs/runEnv311/lib/python3.11/site-packages/garth/http.py", line 140, in login
    self.oauth1_token, self.oauth2_token = sso.login(*args, client=self)
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/arturo/opt/anaconda3/envs/runEnv311/lib/python3.11/site-packages/garth/sso.py", line 79, in login
    client.post(
  File "/Users/arturo/opt/anaconda3/envs/runEnv311/lib/python3.11/site-packages/garth/http.py", line 137, in post
    return self.request("POST", *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/arturo/opt/anaconda3/envs/runEnv311/lib/python3.11/site-packages/garth/http.py", line 127, in request
    raise GarthHTTPError(
garth.exc.GarthHTTPError: Error in request: 401 Client Error: Unauthorized for url: https://sso.garmin.com/sso/signin?id=gauth-widget&embedWidget=true&gauthHost=https%3A%2F%2Fsso.garmin.com%2Fsso%2Fembed&service=https%3A%2F%2Fsso.garmin.com%2Fsso%2Fembed&source=https%3A%2F%2Fsso.garmin.com%2Fsso%2Fembed&redirectAfterAccountLoginUrl=https%3A%2F%2Fsso.garmin.com%2Fsso%2Fembed&redirectAfterAccountCreationUrl=https%3A%2F%2Fsso.garmin.com%2Fsso%2Fembed
tcgoetz commented 10 months ago

The whole exception stack is in garth, so you should file a garth bug and then link it here.

orutra11 commented 10 months ago

As I installed a clean version through pip in a MacOS machine, I figured this should be reproducible and might happen to everyone installing 3.5.0. Even if it is a Garth bug, it breaks garmindb. Is it because of a Garth update? Have you seen this error before?

Thanks!

El El lun, 30 oct 2023 a las 0:35, Tom Goetz @.***> escribió:

The whole exception stack is in garth, so you should file a garth https://github.com/matin/garth bug and then link it here.

— Reply to this email directly, view it on GitHub https://github.com/tcgoetz/GarminDB/issues/209#issuecomment-1784274738, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB5NUJ356WQSFWBUY7AOWMTYB3R5RAVCNFSM6AAAAAA6VEMV5SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBUGI3TINZTHA . You are receiving this because you authored the thread.Message ID: @.***>

tcgoetz commented 10 months ago

I have not seen this issue and can not reproduce it.

One downside of replacing the garmindb login code with garth is that I don't know the code. I think we need the garth maintainer to fix this.

orutra11 commented 10 months ago

Whats your current known working environment?

Thanks again. Arturo.

El El lun, 30 oct 2023 a las 12:36, Tom Goetz @.***> escribió:

I have not seen this issue and can not reproduce it.

One downside of replacing the garmindb login code with garth is that I don't know the code. I think we need the garth maintainer to fix this.

— Reply to this email directly, view it on GitHub https://github.com/tcgoetz/GarminDB/issues/209#issuecomment-1785002410, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB5NUJ37LZOSDC4MENUN6DDYB6GKXAVCNFSM6AAAAAA6VEMV5SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBVGAYDENBRGA . You are receiving this because you authored the thread.Message ID: @.***>

tcgoetz commented 10 months ago

What was the resolution?

orutra11 commented 10 months ago

I can't really pinpoint it to anything. I deleted everything (sources, configs, envs…). Recreated, installed garth from source and then GarminDB from pip and it worked!

Tbh, seems pretty strange that it only happened to me...

El El mar, 31 oct 2023 a las 18:09, Tom Goetz @.***> escribió:

What was the resolution?

— Reply to this email directly, view it on GitHub https://github.com/tcgoetz/GarminDB/issues/209#issuecomment-1787635484, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB5NUJ6PQUYYL3VX24XWIFDYCEWFZAVCNFSM6AAAAAA6VEMV5SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBXGYZTKNBYGQ . You are receiving this because you modified the open/close state.Message ID: @.***>